Skip to content

Conversation

@adamziel
Copy link
Collaborator

@adamziel adamziel commented Nov 26, 2025

Motivation for the change, related issues

Support editing Blueprint bundles in the Blueprint editor:

CleanShot.2025-11-28.at.22.55.30.mp4
  • Full file explorer sidebar for browsing and editing blueprint bundles
  • Code editor with JSON schema autocompletion for blueprint.json
  • Support for creating, renaming, moving, and deleting files/folders
  • Binary file preview for images and other non-text files
  • Autosave to OPFS with restore prompt on page reload
  • "Run Blueprint" button to recreate the Playground from edited bundle
  • Download bundle as ZIP

Implementation

The filesystem abstraction (WritableFilesystem) with in-memory and OPFS backends is a stopgap solution until we connect the Blueprint filesystem types, Git integration filesystem types, and editor filesystem types. I'd like to get to a place where we only have a single Filesystem abstraction, similarly to what php-toolkit does in PHP. TBD on how that will enable working with zip files and git repos.

Testing Instructions (or ideally a Blueprint)

  • Open a temporary Playground and go to the Blueprint tab
  • Edit blueprint.json and verify autocompletion works
  • Create new files and folders in the bundle
  • Write them to the WordPress filesystem using the writeFile step
  • Click "Run Blueprint" and verify the Playground recreates with changes
  • Download the bundle as ZIP and verify contents
  • Refresh the page and verify autosave restore prompt appears
  • Test on narrow screens to verify responsive layout

Moves the toolbar buttons into the same row as the file path,
making better use of horizontal space. The layout wraps
responsively on narrow screens.
…rectory type

When saving a temporary site to OPFS, the blueprint bundle is now persisted
alongside the site data. The originalBlueprintSource is set to { type: 'bundle-directory' }
to indicate the bundle should be loaded from the site's storage directory.

On site load, if originalBlueprintSource.type is 'bundle-directory', the
PersistedBlueprintBundle class is used to load the full bundle from OPFS,
allowing access to bundled resources (not just the JSON declaration).
…ly and avoid duplication

- Pass originalBlueprintSource directly to JSON.stringify instead of creating a new object
- Don't store originalBlueprint when source is bundle-directory (the bundle is stored separately)
- This ensures the source type is correctly persisted and we don't duplicate the blueprint data
…compatibility

PersistedBlueprintBundle now implements the full FilesystemBackend interface
(isDir, fileExists, listFiles, readFileAsBuffer) so it can be used directly
with WritableFilesystem in the blueprint editor.

When loading a stored site with a persisted bundle, the editor now checks if
originalBlueprint is already a filesystem backend and uses it directly instead
of trying to populate from blueprint JSON.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants