SetupWizardController
Corex\Kit\Setup\SetupWizardController · class · Add-ons layer
REST for the nine-step setup wizard (spec 068 US8, T195). It exposes the wizard configuration (kits, brand fields, demo levels, conflict choices), the live nine-step progress, a plan preview with real conflicts and the existing pages the kit would adopt, and a guarded apply that honours operator conflict choices. Reads require manage_options; the apply additionally requires a valid REST nonce (Principle VII) and the person’s confirmation that they have a full backup of their own, and never overwrites existing content without an explicit Replace choice (FR-143). CoreX takes no backup: an apply records the pages it replaces or adopts and the front-page settings, so a reset can put them back (spec 115). The pure seams (config, progressState, planPreview) are unit-tested.
Public API
Section titled “Public API”__construct(SetupWizard $wizard, SetupProgress $progress, BlueprintActivator $activator, ConflictResolver $conflicts, KitAppliedRecord $applied)
Section titled “__construct(SetupWizard $wizard, SetupProgress $progress, BlueprintActivator $activator, ConflictResolver $conflicts, KitAppliedRecord $applied)”register(): void
Section titled “register(): void”canManage(): bool
Section titled “canManage(): bool”canApply(WP_REST_Request $request): bool
Section titled “canApply(WP_REST_Request $request): bool”config(): array
Section titled “config(): array”The static wizard configuration — real kits, brand fields, demo levels, and conflict choices.
progressState(): array
Section titled “progressState(): array”The nine-step progress from the persisted completed-step + blocker facts.
planPreview(string $kit, string $level): array
Section titled “planPreview(string $kit, string $level): array”A read-only plan preview for a kit at a demo level: the modules/flags/pages, the real conflicting pages the operator must choose about, and the existing pages the kit would adopt — no writes. Each conflict and adopted page carries pageTitle, the title the owner’s page has now, which is what the Backup step lists as recorded, and recorded, false for a page an earlier apply made.