Extract site operations to @studio/common#3986
Open
youknowriad wants to merge 4 commits into
Open
Conversation
… @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>
Collaborator
📊 Performance Test ResultsComparing 5188d3b vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 upcomingstudio uilocal 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 thecli-processhelper, which retiresexecute-preview-command.ts. No user-facing change.Independent of the sessions extraction PR; based on
trunk. Part of splitting thestudio uiproof-of-concept (#3953).Testing Instructions
npm run typecheckclean fortools/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).Pre-merge Checklist