Local Community

Access shell from addon (WP-CLI)

Addons documentation seem to be now really sent to the limbo, as no real update has been made recently, and changes made into Local Lightning broke a lot of things.

Long story short, I would request some help to update one of our custom addons.
We created it to run quickly and simply some WP-CLI commands, without having to open the terminal (like a one-click in Local to clear transients, cache, etc…). It used to connect to the docker instance, into the website’s docker running image, and run the commands in there, through the well useful docker object in the context.
https://build.localbyflywheel.com/project/building/context-api#context-docker

But Docker is out, and checking the context object in Electron does not seem to give much. Does anyone have hint onto how we could replace that interface?
The new terminal under Local (Lightning) seems to make use of the OS’ terminal (cmd under Windows…), with a script loaded on top to “set Local environment variables”.
Any idea on how to replicate that environment through an addon to execute those WP-CLI commands?

Many thanks!

@flyjack ?

@clay ? Any help with the AddOns?

I’ve also had questions regarding addons on Local. Docs is not up to date, so not clear how we’re supposed to make things.

Not quite sure how to use this yet (haven’t tested) but it seems like the @getflywheel/local package contains some things to allow running wp-cli commands. https://getflywheel.github.io/local-addon-api/classes/_getflywheel_local_main.services.wpcli.html

My main issue at the moment is that I’m stuck with “Route does not exist”. So I’m not able to render my custom addon settings page