Gadget editor provides a Linux terminal that allows you to run commands or programs, such as the Shopify CLI, in your app's development environment, without needing to use ggt to sync the files and run the Shopify CLI on your local computer.
To open a terminal session, click on the problem or terminal icon in the bottom-left corner of the editor. You can also press Ctrl + ` to toggle the terminal.
When you open a terminal session, a unique Linux user is assigned to it. This allows tools like Shopify CLI to store authentication information or other configurations in the user’s home directory.
Filesystem
The terminal’s default directory is /gadget/app. This directory stores your app’s code. However, it is set as read-only when you access it from a terminal session. If you want to modify the app files or install packages with yarn, use the Gadget editor instead. File changes made in the Gadget editor are pushed to the terminal instantly.
All terminal sessions running in the paused environment will also be terminated. Data stored in the user’s home directory will be deleted.
Shopify CLI integration
We pre-install the Shopify CLI in the sandbox. If you set up a Shopify connection using the Shopify CLI authentication flow, we also automatically inject the tokens needed to start the Shopify CLI into your unique home directory in the terminal. This allows you to skip some authentication steps and start Shopify extension development immediately.
Terminal proxy
In programs like the Shopify CLI, which starts a development server for theme extension development, we provide a special terminal proxy that lets you access localhost resources.
The URL format is https://{appName}--{environmentName}--{portNumber}.gadget.app.
Currently, we only allow proxying ports 3457 and 9293. WebSocket isn’t supported.
AI Assistant integration
If the terminal command exits with a non-zero code (for example, when the command encounters an error), a sparkle icon appears on the left side of the shell prompt. You can click the icon to have the AI assistant analyze the current output and suggest the next steps.
You can also ask the AI assistant to read the current terminal output or even help you run terminal commands.