Skip to content

Agentic UI: Site Creation - #3941

Closed
shaunandrews wants to merge 20 commits into
trunkfrom
agentic-ui/site-creation
Closed

Agentic UI: Site Creation#3941
shaunandrews wants to merge 20 commits into
trunkfrom
agentic-ui/site-creation

Conversation

@shaunandrews

@shaunandrews shaunandrews commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

This PR is AI-assisted and intentionally large. AI was used to draft the initial agentic UI onboarding implementation, iterate on UI states, identify duplicated/default UI behavior, and review cross-app risk. The implementation has been manually reviewed and adjusted, especially around shared sync behavior, default UI impact, and WordPress.com site filtering.

Because of the PR size, reviewers should not treat the raw diff as the primary review artifact. Please use the review guide below to focus on the product and architecture decisions this code implies.

Executive summary

This PR adds an Add Site onboarding flow to the agentic UI (apps/ui, ui-classic) so users can build a new site, start from a blueprint, import a backup, or connect a WordPress.com/Pressable site. The main intent is to bring the core Add Site flows into the agentic UI while the default Studio UI still exists.

Some shared helpers were moved into tools/common so the default UI and agentic UI display the same blueprint curation, site thumbnails, and environment labels. The connect flow creates a local site shell, persists the WordPress.com connection, and starts a first pull from the live site. That lifecycle is intentionally not fully solved in this PR; durable first-pull lifecycle/error state is tracked separately in STU-1956.

The most important review is not line-by-line CSS. Please focus on whether the flow boundaries, shared sync/API changes, and agentic-vs-default UI architecture are acceptable.

Proposed Changes

  • Adds an agentic UI Add Site entry point with Build a new site, Connect a site, and Import from backup paths.
  • Updates the build/new-site path with an empty-site option, featured blueprints, blueprint upload/deep-link handoff, and the shared create-site form.
  • Updates import so a backup can be dropped or selected from the onboarding home, then configured in the create-site form.
  • Adds a WordPress.com/Pressable connect flow that groups remote sites by syncability, creates a local site shell, persists the connection, and starts the initial pull.
  • Moves common blueprint, sync environment, and mshots helpers into tools/common so the default UI and agentic UI do not drift.
  • Updates shared sync site fetching to use the paginated /me/sites v1.3 API and the documented filters param.

Review guide

Please focus review here

  1. Overall Add Site flow shape

    • Entry point: apps/ui/src/ui-classic/router/route-onboarding-home/index.tsx
    • Routes: create, blueprint, import, connect
    • Question: are these the right user-facing choices and navigation paths for the agentic UI?
  2. Connect remote site architecture

    • apps/ui/src/ui-classic/router/route-onboarding-connect/index.tsx
    • apps/ui/src/data/queries/use-wpcom-sites.ts
    • apps/studio/src/modules/sync/lib/ipc-handlers.ts
    • Question: is creating a local shell, persisting the connection, then starting pull the right boundary for this PR?
  3. Shared sync/API behavior

    • tools/common/lib/sync/sync-api.ts
    • tools/common/lib/sync/transform-sites.ts
    • apps/studio/src/stores/sync/wpcom-sites.ts
    • apps/cli/lib/api.ts
    • Question: are the /me/sites v1.3 pagination, filters=atomic,wpcom, staging/environment handling, and CLI/default UI impacts acceptable?
  4. Shared helpers extracted from default UI

    • tools/common/lib/blueprint-curation.ts
    • tools/common/lib/sync/environment-utils.ts
    • tools/common/lib/sync/mshots.ts
    • Question: are these reasonable shared boundaries, or should any remain UI-local?
  5. State handoff patterns

    • apps/ui/src/lib/pending-slot.ts
    • apps/ui/src/lib/pending-backup.ts
    • apps/ui/src/lib/pending-blueprint.ts
    • apps/ui/src/hooks/use-add-site-listener.ts
    • Question: is this acceptable as a lightweight route handoff mechanism for files/deep links?

Okay to skim

  • Most CSS modules and visual layout polish.
  • SVG onboarding illustrations.
  • Dot-grid animation implementation, unless you are specifically reviewing performance/visual polish.
  • Mechanical connector type additions that expose existing IPC capabilities to apps/ui.

Diff breakdown

  • New agentic UI onboarding UX: home picker, create/blueprint/import/connect routes, footer actions, busy overlay, focus handling, keyboard navigation.
  • Remote site connection: paginated WordPress.com site picker, syncability grouping, screenshots, environment badges, connection persistence, first-pull trigger.
  • Shared behavior: blueprint curation, mshots, environment labels, syncable site fetching.
  • Default UI / CLI impact: shared /me/sites fetch now affects CLI sync site resolution; default UI staging/environment handling was aligned.
  • Tests: focused tests for dot grid, add-site listener, and paginated WP.com site query hook.

Screenshots

image image image image image image

Known tradeoffs / follow-ups

  • The agentic UI still lacks a durable lifecycle state system for the first pull after connecting a site. Today it starts the pull after connection and relies on existing sync activity. STU-1956 tracks a proper lifecycle/error model.
  • This PR duplicates some default UI Add Site behavior intentionally. The expectation is that the default UI eventually goes away, so perfect abstraction is not the goal here.
  • The /me/sites fetch now uses v1.3 pagination. This should improve large-account behavior, but it is shared with CLI/default UI and deserves review.

Safety checklist

  • Feature scope: primarily agentic UI; shared sync helpers affect default UI and CLI.
  • Migrations: none.
  • Storage changes: no config schema migration.
  • API compatibility: /me/sites moved to v1.3 for shared syncable-site fetching; uses documented filters param.
  • Rollback: revert this PR to remove agentic Add Site onboarding; no persisted migration to unwind.
  • Performance: dot grid honors reduced motion and sleeps when inactive; remote site picker uses paginated fetch/search.
  • Security: no new credentials stored; WordPress.com auth continues through existing OAuth/IPC paths.
  • Manual testing needed: create empty site, create from blueprint, upload blueprint, import backup, connect WP.com/Pressable site, verify default UI sync picker still behaves correctly.

Testing Instructions

Automated checks used during this PR:

  • npx eslint --fix on modified TypeScript/TSX files
  • npm run typecheck
  • npm test -- apps/ui/src/data/queries/use-wpcom-sites.test.tsx apps/ui/src/hooks/use-add-site-listener.test.tsx
  • npm -w @studio/ui run dev:web -- --host 127.0.0.1 --port 5300, then browser smoke checks for /onboarding, /onboarding/blueprint, /onboarding/create, and /onboarding/connect in light and dark color schemes. The standalone web target renders these routes; its expected backend-connection failures were filtered out of the console check.

Suggested reviewer checks:

  • Start the app with Agentic UI enabled and open Add site.
  • Confirm the home screen shows the dot-grid background, three illustrated cards, and centered header copy.
  • Exercise Build a new site, both empty-site and blueprint paths, and confirm footer Back behavior.
  • Drop or choose a supported backup from the home card and confirm the import configure step seeds a sensible name.
  • Sign in and open Connect a site; confirm syncable sites are visible, grouped sections make sense, search behaves correctly, and single-site/grouped-card sizing feels natural.
  • Smoke-test the default UI sync picker and CLI site lookup paths because shared /me/sites behavior changed.
  • Check both light and dark mode in Electron.

Pre-merge Checklist

  • CI passes.
  • TypeScript check passes.
  • Relevant tests pass.
  • Human visual review in Electron with an authenticated WordPress.com account.
  • Reviewer has explicitly looked at the shared sync/API changes.
  • Reviewer accepts the first-pull lifecycle follow-up being handled outside this PR.
  • Have you checked for TypeScript, React or other console errors?
@shaunandrews shaunandrews changed the title Agentic UI: Site-creation onboarding redesign Jun 23, 2026
@shaunandrews
shaunandrews marked this pull request as ready for review June 29, 2026 19:34
@wpmobilebot

wpmobilebot commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 6ef4ab7 vs trunk

app-size

Metric trunk 6ef4ab7 Diff Change
App Size (Mac) 1317.17 MB 1317.30 MB +0.13 MB ⚪ 0.0%

site-editor

Metric trunk 6ef4ab7 Diff Change
load 1098 ms 743 ms 355 ms 🟢 -32.3%

site-startup

Metric trunk 6ef4ab7 Diff Change
siteCreation 6503 ms 6523 ms +20 ms ⚪ 0.0%
siteStartup 1868 ms 1855 ms 13 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@shaunandrews
shaunandrews requested review from a team and bcotrim June 30, 2026 00:29

@bcotrim bcotrim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On this branch my Pressable site no longer shows up in the sync sites list — on
trunk it does. I traced it to the filterfilters rename on /me/sites
(756ed7c): the singular filter isn't a real API param so it's silently ignored
(all sites come back), while the corrected filters=atomic,wpcom actually filters
and drops Pressable (Jetpack-hosted, not Atomic/WPcom). Confirmed locally —
reverting just the rename brings the site back.

This is a regression, not just a behavior change: The filters filter is the right idea (it correctly drops a8c/non-syncable sites), it just shouldn't drop Pressable too.

Since this filtering + environment-label work (756ed7c + 12c975a) is unrelated
to the site-creation scope here, could we pull it into its own PR? That clears the
regression from this PR and lets us land the filtering properly with focused testing and discussion.

@bcotrim
bcotrim marked this pull request as draft July 14, 2026 16:21
bcotrim added a commit that referenced this pull request Jul 17, 2026
## Related issues

<!--
Link a related issue to this PR. If the PR does not immediately resolve
the issue,
for example, it requires a separate deployment to production, avoid
using the "Fixes" keyword and use "Related to" instead.
-->

- First product increment from #3941

## How AI was used in this PR

<!--
Help reviewers understand what to look for and verify that you have
reviewed the code yourself.
-->

Codex helped compare the original umbrella PR with current trunk,
implement the scoped first increment, and add focused coverage. The
resulting behavior, cleanup paths, and tests were manually reviewed. The
updated visual design still needs human review in both color schemes.

## Proposed Changes

<!--
Explain the intent of this PR:
- What problem does it solve, or what need does it address?
- How does it affect the user (new capability, fix, performance,
accessibility, etc.)?
- Note any user-visible behavior changes or trade-offs.

Focus on the why and the user impact. Avoid listing modified files or
describing implementation mechanics — the diff already shows that.
-->

- Give users one Create flow for blank sites and uploaded JSON or ZIP
Blueprints, including full-window drop, replacement, removal, reset of
prior untouched suggestions, and Blueprint deep-link handoff.
- Preserve user-entered values while applying Blueprint suggestions only
to pristine fields, and retain the existing path and WordPress-version
reliability behavior.
- Keep temporary uploads safe across selection, replacement,
cancellation, creation, and failure recovery.
- Make creation progress accessible, prevent route interaction and
closing while creation is active, restore the flow after failure, and
manage focus between onboarding routes.
- Simplify onboarding around the currently working Create and Import
jobs, redirect the legacy Blueprint route into Create, and remove the
unused gallery surface.
- Bring the updated onboarding design into the reduced flow with the
animated dot-grid backdrop, illustrated job cards, frosted panels,
responsive layouts, persistent footer actions, and compact Blueprint
picker.

## Testing Instructions

<!--
Add as many details as possible to help others reproduce the issue and
test the fix.
"Before / After" screenshots can also be very helpful when the change is
visual.
-->

1. Open onboarding and confirm the home screen shows the dot-grid
backdrop, illustrated Create and Import cards, and persistent Back
action when existing sites are present. Start Create and create a blank
site.
2. Select JSON and ZIP Blueprints using the inline picker and
full-window drop target. Confirm the selected file can be replaced or
removed and that ZIP-relative assets still resolve during creation.
3. Edit the site name or path before selecting a Blueprint. Confirm
suggestions fill pristine fields without overwriting dirty fields.
4. Open a Blueprint deep link and confirm it hands the uploaded
Blueprint to `/onboarding/create`.
5. During creation, confirm the visible status is announced, route
content is inert, Close is disabled, and route headings receive focus.
Force a failure and confirm the form recovers.
6. Confirm uploaded and extracted temporary files are cleaned after
invalid uploads, stale selections, replacement, removal, success, and
failure.
7. Check the Create flow, selected Blueprint state, drop overlay,
advanced settings, and progress state in both light and dark color
schemes.

## Pre-merge Checklist

<!--
Complete applicable items on this checklist **before** merging into
trunk. Inapplicable items can be left unchecked.

Both the PR author and reviewer are responsible for ensuring the
checklist is completed.
-->

- [x] Have you checked for TypeScript, React or other console errors?
@bcotrim bcotrim mentioned this pull request Jul 22, 2026
1 task
bcotrim added a commit that referenced this pull request Jul 28, 2026
## Related issues

<!--
Link a related issue to this PR. If the PR does not immediately resolve
the issue,
for example, it requires a separate deployment to production, avoid
using the "Fixes" keyword and use "Related to" instead.
-->

- Split from #3941
- Follow-up work required in STU-1956

## How AI was used in this PR

<!--
Help reviewers understand what to look for and verify that you've
reviewed the code yourself.
-->

Codex assisted with repository exploration, implementation, focused
regression tests, and interactive UI verification. The lifecycle and
rollback boundaries, connector contracts, and light/dark presentation
were reviewed and iterated during development.

## Proposed Changes

<!--
Explain the intent of this PR:
- What problem does it solve, or what need does it address?
- How does it affect the user (new capability, fix, performance,
accessibility, etc.)?
- Note any user-visible behavior changes or trade-offs.

Focus on the "why" and the user impact. Avoid listing modified files or
describing implementation mechanics — the diff already shows that.
-->

- Add Connect as an Add Site path where signed-out users can log in or
sign up, then find and search all relevant WordPress.com and Pressable
sites with clear environment, availability, and existing-connection
information.
- Create a local shell, persist its live-site relationship, and pull
content into Studio with the correct rollback boundary: failures before
persistence remove the shell, while later failures retain the connection
for recovery.
- Focus the new local site as soon as pulling begins, open its live
progress, and let the user navigate elsewhere while detailed CLI
progress continues in the site status and sidebar. Start the site
automatically when the pull completes.
- Remove every WordPress.com connection when a local site is deleted in
Electron or local-web, with regression coverage for both paths.

| Light | Dark |
|--------|--------|
| <img width="3248" height="2122" alt="image"
src="https://github.com/user-attachments/assets/38eb267f-fc9a-4f86-8b3e-748d0945ed3a"
/> | <img width="3248" height="2122" alt="image"
src="https://github.com/user-attachments/assets/80bebd69-fea7-4a15-91fa-fedc7f5d3d90"
/> |

## Testing Instructions

<!--
Add as many details as possible to help others reproduce the issue and
test the fix.
"Before / After" screenshots can also be very helpful when the change is
visual.
-->

1. Launch the agentic UI and choose **Add site → Connect** while signed
out. Verify both login and signup return to the Connect flow.
2. Test WordPress.com and Pressable sites. Search by name and URL, and
verify available, unavailable, upgrade/transfer-required, and
already-connected groups and explanations.
3. Connect an available site. Verify the shell is created without
starting, the connection is saved, and Studio immediately focuses the
local site with the pull status open.
4. Navigate to another site while pulling. Verify the sidebar continues
to show activity and the detailed CLI pull message remains available on
the connecting site.
5. Verify the site starts automatically after a successful pull and
opens as a usable local copy.
6. Simulate a failure before connection persistence and verify the local
shell and files are removed.
7. Simulate a pull/start failure after connection persistence and verify
the local site and live relationship remain, with the failure shown in
site status.
8. Delete a connected local site in Electron and local-web and verify
every WordPress.com connection for that local site is removed.
9. Exercise offline, loading, empty, request-error, and retry states in
light and dark color schemes.

## Pre-merge Checklist

<!--
Complete applicable items on this checklist **before** merging into
trunk. Inapplicable items can be left unchecked.

Both the PR author and reviewer are responsible for ensuring the
checklist is completed.
-->

- [x] Have you checked for TypeScript, React or other console errors?
@bcotrim bcotrim closed this Jul 30, 2026
@bcotrim

bcotrim commented Jul 30, 2026

Copy link
Copy Markdown
Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants