Skip to content

Latest commit

 

History

History
65 lines (53 loc) · 2.85 KB

File metadata and controls

65 lines (53 loc) · 2.85 KB

AGENTS.md — The Perfect WP Cron

Project Overview

WordPress plugin that replaces WP-Cron with an event-loop job queue powered by Workerman. Executes WP Cron and Action Scheduler jobs at exact scheduled times with zero polling. Provides a WP-CLI interface and admin dashboard for monitoring.

Build Commands

composer install                    # Install PHP dependencies
pnpm install --frozen-lockfile      # Install Node.js dev dependencies
pnpm run build                      # Minify CSS and JS assets
pnpm run css:build                  # Minify admin.css → admin.min.css
pnpm run js:build                   # Minify admin.js → admin.min.js
pnpm run archive                    # Build distributable zip (composer install + build + zip)

Project Structure

the-perfect-wp-cron/
├── the-perfect-wp-cron.php         # Plugin entry point
├── src/
│   ├── class-config.php            # Configuration
│   ├── class-cron-interceptor.php  # Hooks into WP Cron scheduling
│   ├── class-action-scheduler-bridge.php  # Action Scheduler integration
│   ├── class-admin-page.php        # Dashboard UI + AJAX handlers
│   ├── class-cli-commands.php      # WP-CLI `wp queue` commands
│   ├── class-job-log.php           # Job execution logging + cleanup
│   └── ...                         # Worker and queue management classes
├── assets/
│   ├── admin.css                   # Admin dashboard styles (source)
│   ├── admin.js                    # Admin dashboard JS (source)
│   ├── admin.min.css               # Minified (release build only)
│   └── admin.min.js                # Minified (release build only)
├── bin/                            # Worker entry points
├── .distignore                     # Files excluded from distribution zip
├── composer.json
└── package.json

Code Style & Conventions

  • PHP version: >= 8.1
  • Autoloading: Classmap (src/ directory)
  • Namespace prefix: QueueWorker\
  • Constants prefix: QW_
  • No PHPCS config — follow WordPress Coding Standards conventions
  • Text domain: Inherits from WordPress core context
  • Network plugin: Network: true

Key Patterns

  • Registers on init hook via static Cron_Interceptor::register()
  • Action Scheduler bridge registers on action_scheduler_init
  • WP-CLI commands under wp queue namespace
  • Worker process detection via QUEUE_WORKER_RUNNING constant
  • Job log table created on activation, cleaned daily via cron
  • Admin page registered on network_admin_menu (multisite) or admin_menu

Important Notes

  • *.min.js and *.min.css files are generated during release builds — do not commit on feature branches
  • The bin/ directory contains Workerman worker entry points
  • .distignore lists files excluded from the release zip