Piece 1 — Visuals - Add KPI bento bar (score tile with run-health pill, cost tile, last-run tile). Run-health pill shows 'All models healthy' / 'N model(s) degraded' / 'No run yet' sourced from PRV_Model_Registry health fields via collector. - Add config-change trendline marker: inline configMarker Chart.js plugin draws a vertical dashed orange line + pin at every config_version boundary. Legend swatch + annotation note appear when breaks exist. - Chart sits in fixed .prv-chartbox (300px); typeof-Chart guard + .prv-noscript fallback — cannot grow layout, degrades gracefully offline. - PRV_Dashboard_Renderer: new class owns bento tile + trendline rendering. PRV_Ai_Visibility_Panel is now a thin orchestrator (237 lines). - PRV_Ai_Visibility_Collector: trendline query now includes MIN(config_version) per run; collect() adds last_run_counts and config_versions to payload. - PRV_Admin_Page: get_dashboard_css() returns Assay dark palette CSS. Piece 2 — Deploy pipeline - .github/workflows/deploy.yml: on push to main, runs CI, rsyncs plugin to Hostinger PROD (excl. .git .github tests phpunit composer vendor phpcs *.md), purges LiteSpeed, health-checks (200/403). Standalone — not smoke-gated. DoD - Version 0.2.1 in header + constant; CHANGELOG, ARCHITECTURE, CONVENTIONS, CONTEXT all updated same commit. - tests/unit/test-dashboard-panel.php: 27 assertions. - Pre-push checks: no PHP built-in name shadows in bootstrap.php; all includes/*.php files <= 300 lines (max: 298).
70 lines
2.7 KiB
PHP
70 lines
2.7 KiB
PHP
<?php
|
|
/**
|
|
* Plugin Name: PR Vision
|
|
* Plugin URI: https://peptiderepo.com
|
|
* Description: Weekly server-side LLM probes for AI-visibility (GEO) tracking. Records whether peptiderepo.com is cited by LLMs across core peptides, stores time-series, and renders an admin dashboard + settings UI.
|
|
* Version: 0.2.1
|
|
* Author: peptiderepo
|
|
* Author URI: https://peptiderepo.com
|
|
* License: GPL-2.0-or-later
|
|
* Text Domain: pr-vision
|
|
* Requires PHP: 8.1
|
|
*
|
|
* @see ARCHITECTURE.md -- Full data flow and file tree.
|
|
* @see CONVENTIONS.md -- Naming patterns and extension guide.
|
|
* @see CONTEXT.md -- Domain glossary incl. the visibility score formula.
|
|
* @package PrVision
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
/* ── Constants ────────────────────────────────────────────────────────── */
|
|
|
|
define( 'PRV_VERSION', '0.2.1' );
|
|
define( 'PRV_PLUGIN_FILE', __FILE__ );
|
|
define( 'PRV_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
|
define( 'PRV_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
|
define( 'PRV_SCHEMA_VERSION', 2 );
|
|
|
|
/** Maximum HTTP retries for LLM API calls. @var int */
|
|
define( 'PRV_MAX_RETRIES', 3 );
|
|
|
|
/** API request timeout in seconds. @var int */
|
|
define( 'PRV_API_TIMEOUT_SECONDS', 60 );
|
|
|
|
/** Base backoff delay (seconds) between retries. @var int */
|
|
define( 'PRV_RETRY_BASE_DELAY_SECONDS', 2 );
|
|
|
|
/** Default monthly budget cap in USD. @var float */
|
|
define( 'PRV_DEFAULT_MONTHLY_BUDGET_USD', 5.0 );
|
|
|
|
/** WP-Cron hook name for the weekly probe run. @var string */
|
|
define( 'PRV_CRON_HOOK', 'prv_weekly_probe' );
|
|
|
|
/** The site we are tracking citations for. @var string */
|
|
define( 'PRV_TARGET_DOMAIN', 'peptiderepo.com' );
|
|
|
|
/* ── Autoloader ───────────────────────────────────────────────────────── */
|
|
|
|
require_once PRV_PLUGIN_DIR . 'includes/core/class-prv-autoloader.php';
|
|
PRV_Autoloader::register();
|
|
|
|
/* ── Activation / Deactivation ────────────────────────────────────────── */
|
|
|
|
register_activation_hook( __FILE__, array( 'PRV_Activator', 'activate' ) );
|
|
register_deactivation_hook( __FILE__, array( 'PRV_Deactivator', 'deactivate' ) );
|
|
|
|
/* ── Boot ──────────────────────────────────────────────────────────────── */
|
|
|
|
add_action(
|
|
'plugins_loaded',
|
|
static function (): void {
|
|
$plugin = new PRV_Plugin();
|
|
$plugin->init();
|
|
}
|
|
);
|