Skip to content

Setup wizard: in-chat cards alongside the PHP fallback#76

Open
lezama wants to merge 1 commit into
mainfrom
feat/setup-wizard-cards
Open

Setup wizard: in-chat cards alongside the PHP fallback#76
lezama wants to merge 1 commit into
mainfrom
feat/setup-wizard-cards

Conversation

@lezama
Copy link
Copy Markdown
Owner

@lezama lezama commented May 19, 2026

Summary

Converts the first-run setup flow from server-rendered admin pages (PR #72) to in-chat cards that render on the Chat page and inside the floating admin-bar panel. The original PHP wizard at ?page=openclawp-setup stays as a fallback deep-link surface; this PR adds a card-driven path on top.

  • New OpenclaWP_Setup_Rest exposes three small REST routes (GET /setup/state, POST /setup/enable-example-agent, POST /setup/complete) gated on manage_options.
  • New blocks/chat-shared/setup/ directory builds a card stack from declarative step definitions. Each step's "Continue" button POSTs to the REST surface and advances.
  • ChatSurface.jsx mounts the wizard cards on first load when openclaWPConfig.setupCompleted === false.
  • The PHP welcome notice now points to the Chat page so users land in chat-card mode by default; the old wizard URL still works for deep-links.

Why

PR #72 shipped a working but traditional 3-step admin wizard. With the Card UI primitive in place (PR #73) and a floating chat panel reachable from every wp-admin screen (PR #70), the wizard can be a first-class part of the chat surface — same place users will spend time after setup.

Test plan

  • Fresh install: open Chat → wizard cards render above the empty message list.
  • Step 1 "Get started" → advances to step 2.
  • Step 2 detects installed providers; "Continue" is disabled until at least one is.
  • Step 3 toggle → POST /enable-example-agent → POST /complete → wizard cards disappear; example agent now in picker.
  • After completion, refresh: wizard does not reappear; openclawp_setup_completed === '1'.
  • ?page=openclawp-setup still renders the original PHP wizard for deep-linkers.
  • Welcome notice (PR First-run setup wizard for new installs #72) now links to the Chat page.

🤖 Generated with Claude Code

Adds an in-chat, card-driven first-run setup flow that mirrors the
existing PHP wizard (PR #72) and writes to the same two options. The
PHP wizard stays as a fallback deep-link surface at
`?page=openclawp-setup`; the welcome notice now points at the Chat page
so users land in chat-card mode by default.

- New `OpenclaWP_Setup_Rest` exposes three REST routes (`GET
  /setup/state`, `POST /setup/enable-example-agent`, `POST
  /setup/complete`) gated on `manage_options`.
- New `blocks/chat-shared/setup/` builds a single wizard card from
  declarative step definitions; `ChatSurface` mounts it above the
  existing card stack while `openclaWPConfig.setupCompleted === false`.
- Bootstrap localises `setupCompleted` + `setupRestUrl` for the JS
  side and registers the new REST class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant