Automattic / studio

Studio by WordPress.com, a free desktop app that helps developers streamline their local WordPress development workflow.
https://developer.wordpress.com/studio/
GNU General Public License v2.0
138 stars 12 forks source link

Studio: Add dynamic code block to execute wp-cli commands UI AI assistant #232

Closed katinthehatsite closed 1 week ago

katinthehatsite commented 2 weeks ago

Related to https://github.com/Automattic/dotcom-forge/issues/7526

Proposed Changes

This PR adds that dynamic code block that allows to execute CLI commands inside that block. It also does the following:

Testing Instructions

Capture d’écran, le 2024-06-13 à 10 26 19

Pre-merge Checklist

katinthehatsite commented 1 week ago

A note that I noticed that sometimes CLI output could be strange - for instance, I asked the Chat Assistant to give me CLI commands and it suggested the following but running that command gave strange output that requires action:

Capture d’écran, le 2024-06-12 à 21 49 47

We might need to add a better validation of the commands that we want to run to make sure it does not result into the actionable output like this.

kozer commented 1 week ago

@katinthehatsite nice work! I left some comments/suggestions. Other than that it works as expected image

Note that there are some errors in buildkite/unit-tests that are related to the new library you introduced.

katinthehatsite commented 1 week ago

Something that still needs to be looked into but documenting it here for the reviewers:

katinthehatsite commented 1 week ago

Looking at https://github.com/Automattic/dotcom-forge/issues/7526#issuecomment-2165266623 , let's wait until Monday when we decide if we want to keep the Run button at all. If not, then we can remove it and otherwise, this PR is ready.

If we decide to keep it, let's fix the two things mentioned above in https://github.com/Automattic/studio/pull/232#issuecomment-2165073454

sejas commented 1 week ago

@katinthehatsite , would be possible to add an horizontal scroll to the code block?

Screenshot 2024-06-17 at 10 28 25
sejas commented 1 week ago

Let's also avoid displaying the Run button if the wp command has some placeholder < >.

katinthehatsite commented 1 week ago

Hi @sejas, since our conversation earlier this morning, I have done the following:

The only other thing I see is that it seems that E2E tests are timing out on Windows 🤔

For the horizontal scroll, I suggest we open a separate issue and handle it in the follow-up. I am not seeing an obvious fix right away and I would prefer to merge the PR asap as it is starting to grow quite large. What do you think?

Let me know what you think of the changes!