Skip to content

Core Concepts

ProcessWireConsole separates HTTP/Inertia routing from operational logic inside Totoglu\WireConsole\ConsoleRuntime, composed from nine focused subsystem traits.

flowchart TD
    A["Admin opens Setup -> Console (9 RBAC sections)"] --> B["ProcessWireConsole builds RBAC-filtered Inertia props"]
    B --> C["User triggers workspace action (POST ./action/)"]
    C --> D["Validate CSRF + JSON bounds (64 KB / depth 16 / 256 elements)"]
    D --> E["ConsoleRuntime::executeWorkspaceAction() -> guardAndRun()"]
    E --> F["Check section permission + superuser + demo mode + confirmation + cooldown"]
    F --> G["Execute subsystem trait (Migrations / Queues / Backup / Boost / Logs)"]
    G --> H["Write secret-redacted JSON entry to wire-console-audit"]

ConsoleRuntime composes nine dedicated traits backing the 9 sections of Setup -> Console:

  • HandlesWorkspaceActions (central dispatcher for all 34 guarded actions + inspectFile)
  • InteractsWithMigrations (wire_migrations table, run, rollback, reset/refresh/fresh)
  • InteractsWithQueues (queue_jobs & failed_jobs, bounded worker batches, dispatch, retry, purge)
  • InteractsWithSeedingAndScheduling (site/seeders/ with Faker detection + site/schedule/ cron tasks)
  • InteractsWithBackups (site/assets/backups/database/*.sql, safety backups, purge, restore, download)
  • InteractsWithTesting (Pest & Playwright E2E discovery, argument sanitization, execution)
  • InteractsWithBoost (.agents/ sync, configuration, remote skill install, read-only MCP tool runner)
  • InteractsWithScaffolding (identifier validation, stub scaffolding, safe inspectProjectFile())
  • InteractsWithSystemAndLogs (version matrix, maintenance mode, cache flush, log channels)

Every state-changing POST to ./action/ must pass:

  1. ProcessWire $session->CSRF->validate() and strict payload limits (MAX_JSON_BODY_BYTES = 65536, MAX_JSON_DEPTH = 16, MAX_JSON_ELEMENTS = 256).
  2. Section-level permission check (userCanView()) plus superuser checks on high-risk operations (such as backup restore/download or migration reset).
  3. $config->demo guard (isDemoMode()).
  4. Per-session cooldown throttling (checkRateLimit()).
  5. Structured audit logging (audit()) to wire-console-audit with recursive secret redaction.

Next steps