playground-tools icon indicating copy to clipboard operation
playground-tools copied to clipboard

VS Code: Launch Playground in VS Code using "blueprint mode"

Open flexseth opened this issue 1 year ago • 7 comments

When launching WordPress in VS Code via the extension, search first for a blueprint.json file to bootstrap the instance.

If a blueprint.json file is found in the project directory, load up the blueprint at the click of a button.

image

Current available modes

The WordPress Playground VS Code Extension automatically operates in a few different modes. The selected mode depends on the project directory in which it is executed

Automattic modes

  • plugin, theme, or wp-content
  • wordpress
  • wordpress-develop
  • index
  • playground

flexseth avatar Mar 30 '24 23:03 flexseth

+1 on that, or some form of it that allows for multiple Blueprints and is consistent with how Blueprints are supported in GitHub projects.

I'll move this over to the https://github.com/WordPress/playground-tools/ repo where the VS Code extension is maintained.

cc @sejas

adamziel avatar Apr 02 '24 14:04 adamziel

I love the idea! The only thing to bear in mind is that the blueprint should be executed only the first time, because blueprints are expected to create a "running" WordPress instance once.

sejas avatar Apr 05 '24 17:04 sejas

the blueprint should be executed only the first time

great phrasing @sejas - adding this to the docs. It's an important distinction to make

flexseth avatar Apr 06 '24 17:04 flexseth

The only thing to bear in mind is that the blueprint should be executed only the first time, because blueprints are expected to create a "running" WordPress instance once.

@jonathanbossenger did a livestream on the Playground, he was able to get a new site generated by running the blueprint again - using wp-now

In his example, he changed the blueprint step to change the site name. Around 1 hour into the livestream.

If a blueprint can re-write an entire site, it probably would be helpful to throw some type of Caution message to let the user know the entire site could be re-written.

Following progress - feel like this has opportunity to be a great feature. One-click from VS Code or command-line to a WordPress demo website.

flexseth avatar Apr 09 '24 00:04 flexseth

Yes! Some blueprints are less destructive. Maybe we shouldn't autorun a blueprint by default, and instead the user can run it on demand with one click from the UI, as many times as they want. My concern is that maybe some blueprints could be used to hack/or inject some malicious code in the user's computer.

sejas avatar Apr 09 '24 11:04 sejas

Maybe we shouldn't autorun a blueprint by default, and instead the user can run it on demand with one click from the UI, as many times as they want.

Absolutely. The UI for VS Code I think could offer a ton more options. While using the extension I'll try to track down a "Wishlist" of sorts for things I'd love to see. It's the main way I could see using Playground!!

My concern is that maybe some blueprints could be used to hack/or inject some malicious code in the user's computer. From my understanding, due to the "containerized" implementation of the Playground... this is a limited concern?

On the other hand I could see DDoS attacks or other outgoing attacks being more prevelant?

Disclaimer: Not a security expert by any way, but this is a feature that is appealing of Playground (less danger)

flexseth avatar Apr 09 '24 20:04 flexseth

Maybe we shouldn't autorun a blueprint by default, and instead the user can run it on demand with one click from the UI, as many times as they want.

I was working on generating some use journeys that could create errors. GitHub Copilot is magical, by the way... nonetheless, here's two user scenerios it generated for blueprint errors:

User Journey 1: User is trying to import a Blueprint and gets an error

  1. User navigates to the Playground dashboard
  2. User clicks on the "Blueprints" tab
  3. User clicks on the "Import Blueprint" button
  4. User selects a Blueprint file to import
  5. User clicks the "Import" button
  6. User receives an error message

User Journey 2: User is trying to create a new Blueprint and gets an error

  1. User navigates to the Playground dashboard
  2. User clicks on the "Blueprints" tab
  3. User clicks on the "Create Blueprint" button
  4. User fills out the Blueprint form
  5. User clicks the "Create" button
  6. User receives an error message

Which could actually provide some ideas for how the UI could work!

flexseth avatar Apr 10 '24 16:04 flexseth