ggt 

ggt is the command line interface for the Gadget platform, providing additional functionality for working with your Gadget applications using your existing tools on your machine. ggt isn't required for building end-to-end Gadget apps but supports syncing files locally (and more soon) for your preferred coding experience.

Quick Start 

Run the following to sync a my-app.gadget.app application to the ~/gadget/my-app on your local machine:

terminal
npx ggt@latest sync ~/gadget/my-app --app=my-app

With this running in the background, your local ~/gadget/my-app folder will become two-way synced with your application's filesystem in Gadget's cloud. Changes you make locally will be immediately reflected by your application's API and actions if you re-run them.

Install ggt 

The command-line interface for Gadget

terminal
$ npm install -g ggt
$ ggt
Usage 
terminal
ggt [COMMAND]
List of ggt commands 
  • dev: Clone your local filesystem with your environment's filesystem.
  • status: Show the status of your local and environment's filesystem.
  • push: Push your local filesystem.
  • pull: Pull your environment's filesystem.
  • deploy: Deploy your environment to production.
  • open: Open your Gadget app in your default browser.
  • list: List your available applications.
  • login: Log in to your account.
  • logout: Log out of your account.
  • whoami: Print the currently logged in account.
  • version: Print this version of ggt.
Flags 
  • -h , --help: Print command's usage
  • -v, --verbose: Print verbose output
  • --json: Print output as JSON

For more information on a specific command, use 'ggt [COMMAND] --help'

Commands 

ggt dev 

Clone your Gadget environment's source code to your local filesystem.

ggt dev is continually running in the background (unless it is stopped), local file changes are immediately reflected within Gadget, while files that are changed in Gadget are immediately saved to your local filesystem.

Ideal for:

  • Local development with editors like VSCode
  • Storing source code in a Git repository like GitHub

dev looks for a ".ignore" file to exclude certain files/directories from being cloned. The format is identical to a .gitignore file.

These files are always ignored:

  • .DS_Store
  • .gadget
  • .git
  • node_modules
  • Sync only works with your development environment
  • Avoid deleting/moving all your files while sync is running
  • Gadget only supports Yarn v1 for dependency installation
Usage 
terminal
ggt dev [DIRECTORY]
Arguments 

DIRECTORY: The directory to sync files to (default: ".")

Flags 
  • -a, --app=<name>: The Gadget application to clone files to
  • --prefer=<filesystem>: Prefer "local" or "gadget" conflicting changes
  • --once: Sync once and exit
  • --force: Sync regardless of local filesystem state
Example 
terminal
1$ ggt dev ~/gadget/example --app=example
2
3✔ Calculated file changes. 03:28:48 PM
4
5✔ Pulled files. ← 03:28:48 PM
6+ .gitignore created
7+ accessControl/filters/user/tenant.gelly created
8+ accessControl/permissions.gadget.ts created
9+ api/actions/ created
10+ api/models/session/schema.gadget.ts created
11… 32 more
12
1337 changes in total. 37 created.
14
15✔ Your files are up to date. 03:29:01 PM
16
17Application shopify-app
18Environment development
19
20Preview Editor Playground Docs
21
22Waiting for file changes… Press Ctrl+C to stop

ggt status 

Shows you the current environment and git branch you're developing on.

As well as the status of your local files compared to your environment's files.

Usage 
terminal
ggt status
Example 
terminal
1$ ggt status
2Application shopify-app
3Environment development
4
5Preview Editor Playground Docs
6
7✔ Your files are up to date. 03:39:47 PM

ggt push 

Push changes from your local filesystem to your environment's filesystem.

Changes will be calculated from the last time you ran ggt dev, ggt push, or ggt pull on your local filesystem.

terminal
$ ggt push -help
Usage 
terminal
ggt push
Flags 
  • -a, --app=<name>: The application to pull files from
  • -e, -env, --env=<name>: The environment to pull files from
  • --force: Discard un-cloned local changes
Example 
terminal
$ ggt push
$ ggt push --force
$ ggt push --force --env=staging
$ ggt push --force --env=staging --app=example --allow-unknown-directory

ggt pull 

Pull changes from your environment's filesystem to your local filesystem.

Changes will be calculated from the last time you ran ggt dev, ggt push, or ggt pull on your local filesystem.

Usage 
terminal
ggt pull
Flags 
  • -a, --app=<name>: The application to pull files from
  • -e, -env, --env=<name>: The environment to pull files from
  • --force: Discard un-cloned local changes
Example 
terminal
$ ggt pull
$ ggt pull --force
$ ggt pull --force --env=staging
$ ggt pull --force --env=staging --app=example --allow-unknown-directory

ggt deploy 

Deploy an environment to production.

Your local files must match your environment's files before you can deploy. Changes are tracked from the last "ggt dev", "ggt push", or "ggt pull" run locally.

Usage 
terminal
ggt deploy
Flags 
  • -a, --app=<name>: The application to deploy
  • -e, -env, --from=<env>: The environment to deploy from
  • --force: Discard changes to your environment's filesystem
  • --allow-problems: Deploy regardless of any problems the environment has
  • --allow-charges: Deploy even if doing so will add charges to your account
Example 
terminal
$ ggt deploy
$ ggt deploy --from=staging
$ ggt deploy --from=staging --force
$ ggt deploy --from=staging --force --allow-problems

ggt open 

Quickly open your Gadget app in your default browser.

Usage 
terminal
ggt open [LOCATION] [MODEL]
Arguments 
  • LOCATION: The location to open
  • MODEL: The model to open
Flags 
  • -a, --app=<name>: The application to open
  • -e, -env, --env=<env>: The environment to open
  • --show-all: Show all available models to open
Example 
terminal
1$ ggt open
2$ ggt open logs
3$ ggt open permissions
4$ ggt open data modelA
5$ ggt open schema modelA
6$ ggt open data --show-all
7$ ggt open schema --show-all

ggt list 

List the apps available to the currently logged-in user.

Usage 
terminal
ggt list
Example 
terminal
1$ ggt list
2Slug Domain
3─────── ──────────────────
4my-app my-app.gadget.app
5example example.gadget.app
6test test.gadget.app

ggt login 

Log in to your account.

Usage 
terminal
ggt login
Example 
terminal
1$ ggt login
2We've opened Gadget's login page using your default browser.
3
4Please log in and then return to this terminal.
5
6Hello, Jane Doe ([email protected])

ggt logout 

Log out of your account.

Usage 
terminal
ggt logout
Example 
terminal
$ ggt logout
Goodbye

ggt whoami 

Show the name and email address of the currently logged in user.

Usage 
terminal
ggt whoami
Example 
terminal
$ ggt whoami
You are logged in as Jane Doe ([email protected])

ggt version 

Print the version of ggt.

Usage 
terminal
ggt version
Example 
terminal
$ ggt version
0.4.2