The Grit CLI is a command-line interface for Grit. It allows you to apply GritQL patterns and run custom workflows.
Installation
The CLI is available on MacOS and Linux. You can install it from NPM:
npm install --location=global @getgrit/launcher
Alternatively, you can also install Grit with an installation script:
curl -fsSL https://docs.grit.io/install | bash
Once you have installed the CLI, you can optionally run grit init
to initialize a local Grit configuration and grit install
to install additional binaries used for custom workflows.
Applying changes
The primary purpose of the Grit CLI is to apply automatic changes. For example, the following command from our standard library automatically upgrades React Class Components to hooks:
grit apply react_to_hooks
Parameters can be passed to the pattern as well:
grit apply 'remove_import(from=`react`)'
Built-in patterns
The CLI comes with the Grit standard library pre-installed. To view the available transforms, run:
grit list
Telemetry
We collect usage data to help us improve the CLI. We do not collect any source code as part of this.
You can opt out of sending usage data by setting the GRIT_TELEMETRY_DISABLED
environment variable to true
.