Commit Graph

10 Commits

Author SHA1 Message Date
Terence
b92dc4b0d8 fix: resolve PHPCS errors — remove short ternaries and fix docblock placement
- Replace 4 short ternary operators (?:) with explicit conditionals in Cost_Tracker
- Move declare(strict_types=1) after file-level docblocks in 3 template files
  (PHPCS requires docblock immediately after opening PHP tag)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 04:21:56 +07:00
Terence
b7da4f42b9 feat: add LLM cost tracking with budget enforcement and admin dashboard
- New Cost_Tracker class: logs every API call (model, tokens, cost), enforces
  monthly budgets with hard-stop mode, provides aggregated reporting
- New llm_costs database table with indexes on created_at, model, operation
- Modified LLM class: call_openrouter_with_usage() extracts token usage from
  OpenRouter responses; budget gate checks before each API call
- Admin settings: monthly budget (USD), enforcement mode (disabled/warn/hard-stop),
  cost log retention period
- Admin cost dashboard: budget progress bar, daily cost chart (Chart.js),
  per-model and per-operation breakdowns, recent API call log
- PHPUnit tests: 16 tests covering cost calculation, pricing lookups,
  budget enforcement logic, and model validation
- Updated ARCHITECTURE.md with new table schema, data flow, and key decisions
- Updated CONVENTIONS.md with "how to add cost tracking for a new operation"
- Version bump to 2.4.0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 04:18:30 +07:00
peptiderepo
27f72893a9 fix: convert spaces to tabs in peptide-news-plugin.php (PHPCS)
WordPress coding standards require tab indentation. The main plugin
bootstrap file was using 4-space indentation, causing 13 PHPCS errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-12 16:56:48 +07:00
Terence Ong
88766d7005 feat: redesign public news feed with Apple-inspired premium aesthetic
Complete CSS rewrite implementing a clean, modern design:
- Inter font family with refined typography scale (22px titles, 15px body)
- CSS custom properties for full light/dark mode theming
- Card-based article layout with 8px radius, subtle shadows, hover lift
- Generous spacing and whitespace for premium feel (900px max-width)
- Source badges with background treatment, blue-tinted tag pills
- Staggered skeleton loading animations
- WCAG AA accessible focus states and contrast ratios
- Responsive breakpoints at 480px, 768px, 1024px
- Reduced motion and high contrast media query support
- Version bumped to 2.2.0

Design approved by Design Director (8.5/10), QA verified all
28 .pn-* class names preserved with zero React component changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 16:43:05 +07:00
Terence Ong
6c57f6ca11 feat: add structured plugin logging system with admin log viewer
Introduces Peptide_News_Logger class with leveled logging (info, warning,
error, debug) to a custom DB table, auto-pruning at 2000 rows. Adds a
filterable, paginated log viewer to the admin settings page. Instruments
the LLM and Fetcher classes with structured log calls for fetch cycles,
AI processing, and error tracking. Version bumped to 2.1.0.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 15:58:51 +07:00
Terence Ong
f6629a8ed2 chore: bump version to 2.0.1 to bust browser cache
The v2.0.0 React rewrite and subsequent fixes were deployed with
version 1.3.0 in wp_enqueue_script, causing browsers to serve stale
JS/CSS from cache. Bumping to 2.0.1 forces fresh asset downloads.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 14:29:09 +07:00
Terence Ong
1ae831e183 feat: remove AI thumbnails, rewrite frontend with React (v1.3.0)
Remove all AI thumbnail generation infrastructure (too expensive,
poor results) and rewrite the public-facing article feed as a React
SPA mounted via WordPress shortcode.

Changes:
- Remove thumbnail generation, OG scraping, and image download code
  from fetcher, LLM, and admin classes
- Replace server-rendered PHP templates with React component
  (PeptideNewsFeed.jsx) using WordPress-bundled React/ReactDOM
- Add Babel build pipeline for JSX transpilation
- Update REST API to serve ai_summary instead of thumbnail fields
- Redesign public CSS: clean card layout, loading skeletons,
  dark mode, responsive, no thumbnail imagery
- Remove dead admin settings (llm_image_model, thumbnail_fallback)
- Fix call_openrouter() visibility for Content Filter cross-class use
- Bump version to 1.3.0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 09:45:12 +07:00
Peptide News Team
15306ade35 chore: bump version to 1.2.2 — pipeline verification test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 18:28:04 +07:00
Terence Ong
6ed902394d Bump version to 1.2.1 for chart sizing fix deployment
The prepareCanvas wrapper fix (fee4f0f) required a version bump to
bust the LiteSpeed server cache that was serving the old admin-script.js
at the ?ver=1.2.0 URL. A Code Snippets filter on the live server now
rewrites the script version to 1.2.1-<timestamp>.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 13:29:29 +07:00
peptiderepo
b8a266e302 fix(v1.1.0): bump version, add DB upgrade migration on plugins_loaded 2026-04-06 00:36:07 +07:00