Skip to content

Extract site operations to @studio/common#3986

Open
youknowriad wants to merge 4 commits into
trunkfrom
extract-site-operations
Open

Extract site operations to @studio/common#3986
youknowriad wants to merge 4 commits into
trunkfrom
extract-site-operations

Conversation

@youknowriad

Copy link
Copy Markdown
Contributor

Proposed Changes

Behavior-preserving refactor. Moves local-site operations — create, edit, snapshots, sync, and blueprint-bundle extraction — into transport-agnostic modules under @studio/common/sites, so the same backend can power both the desktop app and the upcoming studio ui local web server.

The desktop side now delegates: site-server, cli-site-creator/cli-site-editor, and the preview + sync IPC handlers call the shared modules. The preview snapshot runner is replaced by a shared snapshot manager built on the cli-process helper, which retires execute-preview-command.ts. No user-facing change.

Independent of the sessions extraction PR; based on trunk. Part of splitting the studio ui proof-of-concept (#3953).

Testing Instructions

  • npm run typecheck clean for tools/common, apps/studio, apps/cli.
  • npm test -- apps/studio/src/modules/cli/lib/tests/cli-site-creator.test.ts apps/studio/src/tests/site-server.test.ts (8 tests pass).
  • Smoke: create a site (incl. from a blueprint zip), edit it, take/restore a snapshot, run a sync push/pull.

Pre-merge Checklist

  • Verify site create/edit, snapshots, and sync still work end-to-end in the desktop app.

… @studio/common

Moves the create/edit/snapshots/sync/blueprint-extract logic into transport-agnostic @studio/common/sites modules. The desktop's site-server, cli-site-creator/editor, and the preview + sync IPC handlers now delegate to them (the snapshot/preview runner is replaced by the shared snapshot manager over cli-process, retiring execute-preview-command). No behavior change; this is the shared backend the studio ui local server will reuse. Part of splitting #3953.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@wpmobilebot

wpmobilebot commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 5188d3b vs trunk

app-size

Metric trunk 5188d3b Diff Change
App Size (Mac) 1315.58 MB 1315.60 MB +0.03 MB ⚪ 0.0%

site-editor

Metric trunk 5188d3b Diff Change
load 1054 ms 1077 ms +23 ms ⚪ 0.0%

site-startup

Metric trunk 5188d3b Diff Change
siteCreation 6498 ms 6509 ms +11 ms ⚪ 0.0%
siteStartup 6485 ms 6530 ms +45 ms ⚪ 0.0%

Results are median values from multiple test runs.

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

youknowriad and others added 3 commits June 29, 2026 13:17
Keeps each module's functional description; drops the "shared between the desktop app and the studio ui server" commentary that described the refactor rather than the code.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- blueprint-extract: reuse the guarded createBlueprintTempDir/removeBlueprintTempDir from @studio/common/lib/blueprint-bundle instead of bare fs.rm, restoring the temp-dir path-prefix guard that the renderer-invokable cleanup dropped (and removing the duplicated temp lifecycle).
- create: use crypto.randomUUID() for the blueprint temp filename (Date.now() could collide on concurrent creates).
- sync: await the push temp-dir cleanup so short-lived hosts don't orphan multi-hundred-MB archives.
- ipc-handlers: restore the explicit Promise<ExtractedBlueprintBundle> return type on the extractBlueprintBundle handler (AGENTS.md).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants