Commit Graph

7 Commits

Author SHA1 Message Date
opencode
7d2f795f99 feat: v2.6.0 3-step AI pipeline, VPS worker, REST worker routes
- 3-step OpenRouter pipeline: Gatekeeper scoring/classification, PubMed+Google URL extraction, Markdown summary generation
- REST worker routes /wp-json/peptide-news/v1/worker/* with X-Peptide-News-Token auth
- Standalone Coolify worker (tools/vps-worker) with Dockerfile + docker-compose
- CLI commands, content extractor, pubmed extractor, google url resolver
- 89 PHPUnit tests passing
2026-08-03 19:20:47 +08:00
peptiderepo
377bf22af3 fix: PHP 8.3 TypeError on Articles admin page (v2.5.1) (#32)
Squash-merge of PR #32 — QA APPROVED (2026-06-17 SHA 5c483fdc)

Agent-Session: 2026-06-17-phase1-vps-runner-deploy-500fixes
2026-06-17 13:16:36 +07:00
peptiderepo
59d469ba0f refactor(rest): split 435-line REST API into router + articles handler
Extract article listing endpoint and source-suffix stripping into
Peptide_News_Rest_Articles (195 lines). Main REST API retains route
registration, analytics endpoint wrappers, AJAX delete handler, and
permission/validation helpers (210 lines).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 22:40:34 +07:00
peptiderepo
64e715372a refactor(fetcher): split 611-line fetcher into 3 focused files
Extract source-resolution and RSS-specific logic from the monolithic
Peptide_News_Fetcher:

- class-peptide-news-source-resolver.php (229 lines) — aggregator
  source detection, redirect resolution, title parsing, backfill
- class-peptide-news-rss-source.php (118 lines) — RSS/Atom feed
  fetching and SimplePie item processing
- class-peptide-news-fetcher.php (271 lines) — orchestrator with
  NewsAPI, storage, pruning, caching, and AI post-processing

Also consolidated duplicate clear_article_cache/invalidate_rest_api_cache
methods (they were identical) into a single clear_article_cache().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 22:30:50 +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
Terence Ong
e6887e810f Add content filter to block ads, press releases, and promotional content
Two-tier filtering during article fetch: keyword/pattern rules as a fast
first pass, then optional LLM classification for borderline cases via
OpenRouter. Configurable sensitivity (strict/moderate/lenient), editable
keyword lists, blocked domain list, and admin stats display. Includes
30 unit tests covering domain blocking, title/body keywords, URL paths,
edge cases, and prompt structure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 14:14:16 +07:00
Terence Ong
849ffa1260 Add CI/CD pipeline with automated testing and SFTP deployment
Introduces GitHub Actions workflows for continuous integration and
deployment. CI runs PHP linting (7.4, 8.1, 8.3), PHPCS with WordPress
coding standards, PHPUnit tests across PHP versions, and JS syntax
checks. Deployment to Hostinger via FTPS triggers on push to main
after all CI checks pass, with optional LiteSpeed cache purge.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 13:41:47 +07:00