peptiderepo 8274d54a5e PR Vision v0.2.0: admin/settings interface + correctness fixes
Requirements 1-8 + all non-negotiables:

1. Model manager (CRUD): PRV_Model_Registry, prv_models v2 option, versioned
   idempotent migration from v0.1.x flat-string format, Settings page CRUD.

2. Per-model run-health: PRV_Model_Registry::update_health() after each run;
   health badges (Healthy/Retired?/Disabled/Unknown) in model table + dashboard.

3. Metric comparability: PRV_Config_Version stamps every run with config_version;
   save-bar warning on scoring-relevant changes; orphaned rows excluded by version.

4. Projected cost at save: PRV_Config::get_projected_cost(); over-cap warning;
   prv_last_run_truncated option + visible notice when cap hit mid-run.

5. Config surface: peptide set, intents, cadence (reschedules cron), budget cap;
   all validated + sanitized; next-run timestamp shown.

6. API-key three-state: not-defined / defined-ok / defined-failed; derived from
   ledger; never displays the key.

7. Run-lock: PRV_Run_Lock (transient); cron tick skips if locked; Run-now
   refuses with clear message; lock released in finally block.

8. Design fixes: dark-ink focus ring on bright fills; disabled-row full AA
   contrast (no opacity); toggle disabled on retired rows; save-bar-level
   warning (role=alert); chip text #B4BDC7 6.83:1 AA; keyboard-sortable headers
   (<button>+aria-sort); aria-live on Test chip; z-index:50 save-bar;
   run-now double-fire guard; @media print light overrides.

New: PRV_Upgrader (runs migrations on plugins_loaded, not just activation),
PRV_Config_Version, PRV_Run_Lock, PRV_Settings_Page, PRV_Settings_Renderer,
PRV_Model_Manager_Table, PRV_Model_Test_Ajax.

Tests: test-model-registry, test-run-lock, test-config-version,
       test-projected-cost, test-cron-reschedule (+ updated probe-runner,
       uninstall, bootstrap).

Schema: config_version INT column added via dbDelta (idempotent).
Uninstall: purges all v0.2 prv_* options + transients.
2026-06-14 06:43:54 +00:00

PR Vision

An internal WordPress plugin that runs weekly server-side LLM probes to measure whether peptiderepo.com is cited by AI assistants across core peptides.

v0.1.0 — AI-visibility dashboard only. Internal use; no public-facing output.


Purpose

GEO (Generative Engine Optimization) is peptiderepo.com's #1 strategic goal. This plugin provides the measurement instrument: weekly LLM probes → time-series storage → admin trendline + per-peptide standings.

The displayed metric is a directional proxy — API probes do not replicate the consumer ChatGPT/Gemini experience (different retrieval, personalisation, and system prompts), but they provide a consistent, trackable signal.


Required wp-config.php constants

// OpenRouter API key (sk-or-…) — required for all providers.
define( 'PRV_OPENROUTER_API_KEY', 'sk-or-YOUR_KEY_HERE' );

// Cloudflare AI Gateway routing (optional — falls back to direct OpenRouter).
define( 'PRV_CF_ACCOUNT_ID', 'YOUR_CF_ACCOUNT_ID' );
define( 'PRV_CF_GATEWAY_ID', 'YOUR_GATEWAY_NAME' );

Never commit these values. They are read at runtime from wp-config.php only.


Architecture

See ARCHITECTURE.md for the full file tree, data flow, and design decisions.


Admin page

Navigate to PR Vision in the WordPress admin sidebar (manage_options required).

The page shows:

  • A proxy-metric disclaimer note.
  • A Chart.js trendline of the visibility score across runs.
  • A per-peptide standings table (cited?, our position, top competitor domains).
  • Month-to-date cost vs. the monthly cap.
  • A "Run now" button to trigger an on-demand probe run.

Scheduling

A weekly WP-Cron event (prv_weekly_probe) is registered on plugin activation and cleared on deactivation. Probe runs (cron or manual) respect the hard monthly budget cap.


Cost cap

Default cap: $5.00 USD/month (configurable via the prv_monthly_budget_usd option). The runner checks the month-to-date spend before each API call and stops gracefully when the cap is reached — partial runs are recorded, never over-spend.


Uninstall

Uninstalling the plugin drops the {prefix}prv_ai_visibility table and deletes all prv_* options. Deactivation only clears the cron schedule.


Developer notes

  • PHP 8.1+ required. No runtime Composer dependencies.
  • All classes prefixed PRV_. All options/hooks prefixed prv_.
  • Files are kept under 300 lines; one class per file.
  • See CONVENTIONS.md for naming patterns and extension guides.
  • See CONTEXT.md for the domain glossary including the visibility score formula.
Description
No description provided
Readme 368 KiB
Languages
PHP 100%