This document contains the help content for the grit
command-line program.
Command Overview:
grit
↴grit check
↴grit list
↴grit apply
↴grit doctor
↴grit auth
↴grit auth login
↴grit auth logout
↴grit auth get-token
↴grit auth refresh
↴grit install
↴grit init
↴grit workflows
↴grit workflows list
↴grit workflows upload
↴grit patterns
↴grit patterns list
↴grit patterns test
↴grit patterns edit
↴grit patterns describe
↴grit version
↴
grit
Software maintenance on autopilot, from grit.io
Usage: grit [OPTIONS] <COMMAND>
For help with a specific command, run grit help <command>
.
Subcommands:
check
— Check the current directory for pattern violationslist
— List everything that can be applied to the current directoryapply
— Apply a pattern or migration to a set of filesdoctor
— Print diagnostic information about the current environmentauth
— Authentication commands, rungrit auth --help
for more informationinstall
— Install supporting binariesinit
— Install grit modulesworkflows
— Workflow commands, rungrit workflows --help
for more informationpatterns
— Patterns commands, rungrit patterns --help
for more informationversion
— Display version information about the CLI and agents
Options:
--json
— Enable JSON output, only supported on some commandsPossible values:
true
,false
--jsonl
— Enable JSONL output, only supported on some commandsPossible values:
true
,false
--log-level <LOG_LEVEL>
— Override the default log level (info)--grit-dir <GRIT_DIR>
— Override the default .grit directory location
grit check
Check the current directory for pattern violations
Usage: grit check [OPTIONS] [PATHS]...
Arguments:
<PATHS>
— The target paths to apply the checks toDefault value:
.
Options:
--fix
— Apply fixes to all rewritesPossible values:
true
,false
--verbose
— Show verbose outputPossible values:
true
,false
--level <LEVEL>
— Check only patterns at or above an enforcement level--no-cache
— Do not use cachePossible values:
true
,false
--refresh-cache
— Clear cache before running checkPossible values:
true
,false
--github-actions
— Output annotations for a GitHub actions workflowPossible values:
true
,false
--only-in-json <ONLY_IN_JSON>
— Only analyze ranges inside a provided eslint-style JSON string. The JSON should be an array of objects formatted as[{"filePath": "path/to/file", "messages": [{"line": 1, "column": 1, "endLine": 1, "endColumn": 1}]}]
.
grit list
List everything that can be applied to the current directory
Usage: grit list [OPTIONS]
Options:
--level <LEVEL>
— List only at or above an enforcement level--source <SOURCE>
— List items from a specific sourceDefault value:
all
Possible values:
all
: All patternslocal
: Only patterns from the local repouser
: Only patterns from the user config
--language <LANGUAGE>
— List only items targeting a specific languagePossible values:
js
,html
,css
,json
,java
,csharp
,python
,markdown
,go
,rust
,ruby
,solidity
,hcl
,yaml
,sql
,vue
,toml
,php
,php
grit apply
Apply a pattern or migration to a set of files
Usage: grit apply [OPTIONS] <PATTERN_OR_WORKFLOW> [PATHS]...
Arguments:
<PATTERN_OR_WORKFLOW>
— The pattern to apply, in a few forms:- A pattern name (ex.
raw_no_console_log
) - A pattern by itself (ex.
'`console.log` => `console.error`'
) - A pattern call, with arguments (ex.
'openai_main(client=
openai)'
) - A path to a pattern file (ex.
./patterns/raw_no_console_log.grit
) - A workflow name (ex.
lint
)
- A pattern name (ex.
<PATHS>
Default value:
.
Options:
--input <INPUT>
— JSON input parameter to pass to the workflow--remote
— Run the workflow remotely on Grit CloudPossible values:
true
,false
--workflow-id <WORKFLOW_ID>
— Workflow ID to set, only applicable when running remotely--watch
— Watch the workflow for updates (only applicable when running remotely)Possible values:
true
,false
--verbose
— Print verbose outputPossible values:
true
,false
--output <OUTPUT>
Default value:
standard
Possible values:
none
,standard
,compact
-m
,--limit <LIMIT>
--dry-run
— Show a dry-run of the changes that would be appliedDefault value:
false
Possible values:
true
,false
--force
— Force apply, even if there are uncommitted changesDefault value:
false
Possible values:
true
,false
-i
,--interactive
— Selectively apply changes interactivelyDefault value:
false
Possible values:
true
,false
--output-file <OUTPUT_FILE>
— Path to a file to write the results to, defaults to stdout--stdin
— Use this option when you want to transform code piped fromstdin
, and print the output tostdout
.
If you use this option, you must specify a file path, to allow Grit to determine the language of the code.
Example: echo 'console.log(hello)' | grit apply '
hello=>
goodbye' file.js --stdin This will print
console.log(goodbye)` to stdout
Possible values: true
, false
--cache
— Use cachePossible values:
true
,false
--refresh-cache
— Clear cache before running applyPossible values:
true
,false
--ai
— Interpret the request as a natural language requestPossible values:
true
,false
--language <LANGUAGE>
— Change the default language to use for the pattern (if unset, JavaScript is used by default)Possible values:
js
,html
,css
,json
,java
,csharp
,python
,markdown
,go
,rust
,ruby
,solidity
,hcl
,yaml
,sql
,vue
,toml
,php
,php
--only-in-json <ONLY_IN_JSON>
— Only analyze ranges inside a provided eslint-style JSON string. The JSON should be an array of objects formatted as[{"filePath": "path/to/file", "messages": [{"line": 1, "column": 1, "endLine": 1, "endColumn": 1}]}]
.
grit doctor
Print diagnostic information about the current environment
Usage: grit doctor
grit auth
Authentication commands, run grit auth --help
for more information
Usage: grit auth <COMMAND>
Subcommands:
login
— Log in with grit.iologout
— Remove your grit.io credentialsget-token
— Get your grit.io tokenrefresh
— Refresh your grit.io auth (this will also happen automatically when your token expires)
grit auth login
Log in with grit.io
Usage: grit auth login
grit auth logout
Remove your grit.io credentials
Usage: grit auth logout
grit auth get-token
Get your grit.io token
Usage: grit auth get-token
grit auth refresh
Refresh your grit.io auth (this will also happen automatically when your token expires)
Usage: grit auth refresh
grit install
Install supporting binaries
Usage: grit install [OPTIONS]
Options:
--update
— Look for updates and install themPossible values:
true
,false
--app <APP>
— Specify a specific app to installPossible values:
grit
,gouda
,workflow-runner
grit init
Install grit modules
Usage: grit init [OPTIONS]
Options:
--global
— Update global grit modulesDefault value:
false
Possible values:
true
,false
grit workflows
Workflow commands, run grit workflows --help
for more information
Usage: grit workflows <COMMAND>
Subcommands:
list
— List all available workflowsupload
— Upload a workflow
grit workflows list
List all available workflows
Usage: grit workflows list
grit workflows upload
Upload a workflow
Usage: grit workflows upload <WORKFLOW_PATH> <WORKFLOW_ID>
Arguments:
<WORKFLOW_PATH>
<WORKFLOW_ID>
grit patterns
Patterns commands, run grit patterns --help
for more information
Usage: grit patterns <COMMAND>
Subcommands:
list
— List all available named patternstest
— Test patterns against expected outputedit
— Open a pattern in the studiodescribe
— Describe a pattern
grit patterns list
List all available named patterns
Usage: grit patterns list [OPTIONS]
Options:
--level <LEVEL>
— List only at or above an enforcement level--source <SOURCE>
— List items from a specific sourceDefault value:
all
Possible values:
all
: All patternslocal
: Only patterns from the local repouser
: Only patterns from the user config
--language <LANGUAGE>
— List only items targeting a specific languagePossible values:
js
,html
,css
,json
,java
,csharp
,python
,markdown
,go
,rust
,ruby
,solidity
,hcl
,yaml
,sql
,vue
,toml
,php
,php
grit patterns test
Test patterns against expected output
Usage: grit patterns test [OPTIONS]
Options:
--filter <FILTER>
— Regex of a specific pattern to test--exclude <EXCLUDE>
— Tags and pattern names to exclude. Only direct matches will be excluded.--verbose
— Show verbose outputPossible values:
true
,false
--update
— Update expected test outputsPossible values:
true
,false
--watch
— Enable watch mode on .grit dirPossible values:
true
,false
grit patterns edit
Open a pattern in the studio
Usage: grit patterns edit <PATH>
Arguments:
<PATH>
— The pattern path to edit
grit patterns describe
Describe a pattern
Usage: grit patterns describe <NAME>
Arguments:
<NAME>
— The pattern name to describe
grit version
Display version information about the CLI and agents
Usage: grit version