greptile 3.0.7 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ # Changelog
2
+
3
+ All notable changes to the Greptile CLI.
4
+
5
+ ## 3.1.0 - 2026-06-11
6
+
7
+ ### Added
8
+
9
+ - API key authentication: sign in with `greptile login --api-key`, or set
10
+ `GREPTILE_API_KEY` for non-interactive and CI use.
11
+ - Persistent settings via the new `greptile config` command.
12
+ - Review history now shows the confidence score for each review.
13
+ - A notification fires when a blocking review finishes, so you can switch
14
+ away while it runs.
15
+ - Sensitive files (secrets, keys, credentials) are held back from review
16
+ payloads instead of being uploaded.
17
+
18
+ ### Fixed
19
+
20
+ - `greptile review --resume` no longer breaks partway through the resume
21
+ lifecycle.
22
+ - Git remotes that use SSH host aliases (from `~/.ssh/config`) are now
23
+ resolved correctly before dispatching a review.
24
+ - Clearer, friendlier error when a git remote can't be recognized.
25
+
26
+ ### Changed
27
+
28
+ - Interactive prompts were rebuilt on the same ink renderer as the rest of
29
+ the UI, for consistent look and keyboard handling.
30
+ - Command-line parsing was migrated to commander: help text, error messages,
31
+ and unknown-command suggestions are more consistent.
package/README.md CHANGED
@@ -1,104 +1,219 @@
1
1
  # greptile
2
2
 
3
- AI code review in your terminal. Get the same review Greptile runs on your team's pull requests, right inside your editor's shell, before you push.
3
+ Greptile code review in your terminal. Runs the same review Greptile posts on your team's pull requests, on your local branch before you push.
4
+
5
+ - [Install](#install)
6
+ - [Quick start](#quick-start)
7
+ - [Commands](#commands)
8
+ - [Reviewing](#reviewing)
9
+ - [Authentication](#authentication)
10
+ - [Sensitive files](#sensitive-files)
11
+ - [Configuration](#configuration)
12
+ - [Diagrams](#diagrams)
13
+ - [Updating](#updating)
14
+ - [Reference](#reference)
4
15
 
5
16
  ## Install
6
17
 
7
- Pick whichever is easiest for you.
8
-
9
18
  ```sh
10
19
  # macOS, via Homebrew
11
20
  brew install greptileai/tap/greptile
12
21
 
13
- # Any platform with Node 22 or newer
22
+ # Any platform, via npm
14
23
  npm install -g greptile
15
24
 
16
- # Direct install for macOS (also needs Node 22+)
25
+ # macOS install script
17
26
  curl -fsSL https://raw.githubusercontent.com/greptileai/cli/main/install.sh | bash
18
27
  ```
19
28
 
29
+ > ℹ️ **Note:** The npm and script installs need Node 22 or newer.
30
+
20
31
  ## Quick start
21
32
 
22
33
  ```sh
23
- greptile login # opens your browser to sign in
34
+ greptile login # opens your browser to sign in
24
35
  cd path/to/your/repo
25
- greptile review # review HEAD against the default branch
36
+ greptile review # reviews HEAD against the default branch
26
37
  ```
27
38
 
28
- That's it. Comments appear in the terminal as they come in.
39
+ Comments appear in the terminal as they come in.
40
+
41
+ ## Commands
29
42
 
30
- ## Examples
43
+ | Command | What it does |
44
+ | --------------------------- | -------------------------------------------------------------- |
45
+ | `greptile review` | Review the current branch against its base. |
46
+ | `greptile review show [ID]` | Reopen a previous review. Omit the ID to pick from a list. |
47
+ | `greptile login` | Sign in through your browser, or with `--api-key`. |
48
+ | `greptile logout` | Remove stored credentials. |
49
+ | `greptile whoami` | Show who you are signed in as and your organizations. |
50
+ | `greptile config` | Save default settings (`list`, `get`, `set`, `unset`, `path`). |
51
+ | `greptile update` | Update the CLI to the latest version. |
31
52
 
32
- **Review against a specific base branch:**
53
+ Run any command with `--help` for its full flag list.
54
+
55
+ ## Reviewing
56
+
57
+ Review against a specific base branch:
33
58
 
34
59
  ```sh
35
60
  greptile review -b main
36
61
  ```
37
62
 
38
- **Show findings next to the actual code lines:**
63
+ Show findings beside the changed code instead of as a comment list:
39
64
 
40
65
  ```sh
41
66
  greptile review --diff
42
67
  ```
43
68
 
44
- **Pipe to another tool or save the raw results:**
69
+ Continue a review that stopped partway:
45
70
 
46
71
  ```sh
47
- greptile review --json > review.json
72
+ greptile review --resume
48
73
  ```
49
74
 
50
- **Re-open a previous review (pick from a list, or pass an ID):**
75
+ Reopen an earlier review:
51
76
 
52
77
  ```sh
53
- greptile review show
54
- greptile review show abc123
78
+ greptile review show # pick from recent reviews
79
+ greptile review show abc123 # open one by ID
55
80
  ```
56
81
 
57
- **Keep going on a review that stopped halfway:**
82
+ ### Machine-readable output
58
83
 
59
84
  ```sh
60
- greptile review --resume
85
+ greptile review --json > review.json # structured JSON
86
+ greptile review --text # plain text (default when piped)
87
+ greptile review --agent # alias for --text, for AI agents
61
88
  ```
62
89
 
63
- ## More than one Greptile organization?
90
+ Exit codes are stable for scripting; see [Reference](#reference).
64
91
 
65
- Nothing to configure. Each repository is owned by exactly one Greptile organization, and `greptile review` infers the right one from the repo's remote URL. As long as you're a member of that organization, the review runs against it.
92
+ ### Working in multiple organizations
66
93
 
67
- `greptile whoami` lists the organizations you belong to if you want to confirm membership.
94
+ There is nothing to configure. Each repository belongs to one Greptile organization, and `greptile review` infers it from the repo's remote URL. As long as you're a member of that organization, the review runs against it. `greptile whoami` lists your organizations.
68
95
 
69
- ## Diagrams
96
+ ## Authentication
70
97
 
71
- When a review's summary includes a Mermaid diagram, greptile renders it inline in kitty and Ghostty, and links the SVG file in other terminals. The first time a diagram needs to render, greptile downloads a small renderer ([mmdr](https://github.com/1jehuang/mermaid-rs-renderer)) into `~/.cache/greptile/`. To opt out, set `GREPTILE_NO_AUTO_INSTALL=1`.
98
+ `greptile login` signs you in through your browser (OAuth) and stores a refreshable token at `~/.greptile/auth.json`. Tokens refresh automatically. If the browser can't reach the CLI on the same machine (SSH sessions, containers, remote/cloud dev environments) the browser shows a login code instead; paste it at the `Paste code here if prompted:` prompt to finish signing in.
72
99
 
73
- ## Reference
100
+ For CI or headless environments, use an API key instead. Create one in the Greptile dashboard, then either export it or store it on the machine:
101
+
102
+ ```sh
103
+ # Per-shell or CI
104
+ export GREPTILE_API_KEY=...
105
+ greptile review
106
+
107
+ # Or persist it: prompts for the key, or reads it from stdin
108
+ greptile login --api-key
109
+ echo "$GREPTILE_API_KEY" | greptile login --api-key
110
+ ```
111
+
112
+ > ⚠️ **Warning:** Don't pass the API key as a command-line argument. Arguments are visible in shell history and process lists; use the prompt, stdin, or the environment variable instead.
113
+
114
+ When `GREPTILE_API_KEY` is set, it takes precedence over a stored sign-in.
115
+
116
+ > ℹ️ **Note:** API keys are scoped to an organization, not a person, so reviews run under the organization's identity. Use OAuth sign-in if you want per-developer attribution.
117
+
118
+ ## Sensitive files
119
+
120
+ Before sending anything, `greptile review` holds back changed files that look like they contain secrets, so a mistakenly committed `.env` file or private key stays on your machine. When files are held back, the review prints a one-line note naming them. A file is held back when:
121
+
122
+ - **Its name suggests secrets:** dotenv files (`.env`, `.env.local`, ...), key material and credential stores (`*.pem`, `*.key`, `*.p12`, `id_rsa`, `.npmrc`, `credentials`, ...). Placeholder files like `.env.example` are fine and still sent.
123
+ - **Its diff contains a recognizable credential:** private keys, or API keys for AWS, GitHub, Slack, Google, Stripe, Anthropic, or OpenAI.
124
+ - **It matches a `.gitignore` rule** but was committed anyway (force-added, or added before the rule existed). These are held back quietly.
125
+
126
+ The rest of the review is unaffected. If every changed file is held back, the review stops and tells you.
127
+
128
+ ### Including a held-back file
74
129
 
75
- Full command surface:
130
+ If a file was held back and you do want it reviewed, list it with `--include`:
76
131
 
77
132
  ```sh
78
- greptile login | logout | whoami
79
- greptile review [-b BRANCH] [--diff] [--resume] [--json | --text | --agent]
80
- [--context LINES] [--width COLUMNS] [--no-color]
81
- greptile review show [ID] # same review flags apply
133
+ greptile review --include .env config/db.pem
134
+ greptile review --include .env --include config/db.pem
82
135
  ```
83
136
 
84
- Environment variables:
137
+ > ⚠️ **Warning:** Files passed to `--include` skip the sensitive-file check entirely and are sent as-is. Double-check they don't contain real credentials first.
85
138
 
86
- | Variable | What it does |
87
- | -------------------------- | -------------------------------------------------------------------------- |
88
- | `GREPTILE_INLINE_IMAGES` | Force inline kitty diagrams on (`1`, `true`, `kitty`) or off (`0`, `off`). |
89
- | `GREPTILE_NO_AUTO_INSTALL` | Skip the one-time mmdr download. |
90
- | `GREPTILE_NO_UPDATE_CHECK` | Skip the daily check for a newer CLI release. |
91
- | `NO_COLOR` | Turn off ANSI color. |
92
- | `FORCE_COLOR` | Turn on ANSI color even when stdout is not a TTY. |
93
- | `COLUMNS` | Override the output width. |
139
+ > 💡 **Tip:** Two cases that can be surprising:
140
+ >
141
+ > - A commit that **removes** a hard-coded secret is also held back, because the removed value still appears in the diff. Use `--include` to review that cleanup commit.
142
+ > - A **rename** away from a sensitive name (say `.env` to `config.txt`) is held back too, based on the original path.
94
143
 
95
- Exit codes (useful for scripting):
144
+ ## Configuration
96
145
 
97
- | Code | Meaning |
98
- | ----- | --------------------------------------------------------------------------------- |
99
- | `0` | Review finished. |
100
- | `1` | Review couldn't finish (sign-in expired, server error, repo not connected, etc.). |
101
- | `2` | Wrong invocation (not inside a git repo, invalid flag, etc.). |
102
- | `130` | You hit Ctrl-C. |
146
+ Save defaults instead of repeating flags:
147
+
148
+ ```sh
149
+ greptile config set review.layout diff # always show findings beside the code
150
+ greptile config set review.context 30 # more code around each finding
151
+ greptile config list # every setting and where it comes from
152
+ greptile config unset review.layout # back to the default
153
+ ```
154
+
155
+ | Setting | Values | Matching flag |
156
+ | ---------------- | --------------------------------------- | ------------------------------------------------------ |
157
+ | `color` | `true` (default), `false` | `--color` / `--no-color` |
158
+ | `review.output` | `auto` (default), `text`, `json` | `--text` / `--json` |
159
+ | `review.layout` | `comments` (default), `diff` | `--layout` (`--diff` is shorthand for `--layout diff`) |
160
+ | `review.context` | `0` to `60` (default `15`) | `--context` |
161
+ | `review.width` | `40` to `240` (default: terminal width) | `--width` |
162
+
163
+ A flag passed on the command line always wins over a saved setting for that run.
164
+
165
+ Settings live in `~/.config/greptile/config.json` (or `$XDG_CONFIG_HOME/greptile/config.json`); `greptile config path` prints the exact location. The file includes a `$schema` reference to a published JSON Schema, so editors can validate and autocomplete it if you edit it by hand.
166
+
167
+ ## Diagrams
168
+
169
+ When a review summary includes a Mermaid diagram, greptile renders it inline in kitty and Ghostty, and links an SVG file in other terminals. The first time a diagram renders, greptile downloads a small renderer ([mmdr](https://github.com/1jehuang/mermaid-rs-renderer)) into `~/.cache/greptile/`. Set `GREPTILE_NO_AUTO_INSTALL=1` to skip the download.
170
+
171
+ ## Updating
172
+
173
+ ```sh
174
+ greptile update
175
+ ```
176
+
177
+ This checks for a newer release and upgrades in place. Homebrew installs are the exception: run `brew upgrade greptile` instead (the command will tell you). The CLI also checks for updates once a day and prints a notice when one is available; set `GREPTILE_NO_UPDATE_CHECK=1` to turn that off.
178
+
179
+ ## Reference
180
+
181
+ ### Command synopsis
182
+
183
+ ```sh
184
+ greptile login [--api-key] | logout | whoami
185
+ greptile review [-b BRANCH] [--layout comments|diff | --diff] [--resume] [--include PATH...]
186
+ [--json | --text | --agent] [--context LINES] [--width COLUMNS] [--no-color]
187
+ greptile review show [ID] # same output flags as review
188
+ greptile config list | get KEY | set KEY VALUE | unset KEY | path
189
+ greptile update
190
+ ```
103
191
 
104
- Credentials live at `~/.greptile/auth.json` and refresh themselves automatically.
192
+ ### Environment variables
193
+
194
+ | Variable | What it does |
195
+ | -------------------------- | --------------------------------------------------------------------- |
196
+ | `GREPTILE_API_KEY` | Authenticate with an API key; takes precedence over a stored sign-in. |
197
+ | `GREPTILE_INLINE_IMAGES` | Force inline diagrams on (`1`, `true`, `kitty`) or off (`0`, `off`). |
198
+ | `GREPTILE_NO_AUTO_INSTALL` | Skip the one-time diagram renderer download. |
199
+ | `GREPTILE_NO_UPDATE_CHECK` | Skip the daily check for a newer CLI release. |
200
+ | `NO_COLOR` | Turn off ANSI color. |
201
+ | `FORCE_COLOR` | Turn on ANSI color even when output is piped. |
202
+ | `COLUMNS` | Override the output width. |
203
+
204
+ ### Exit codes
205
+
206
+ | Code | Meaning |
207
+ | ----- | -------------------------------------------------------------------------------- |
208
+ | `0` | Review finished. |
209
+ | `1` | Review couldn't finish (sign-in expired, server error, repo not connected, ...). |
210
+ | `2` | Invalid invocation (not inside a git repo, unknown flag, ...). |
211
+ | `130` | Interrupted with Ctrl-C. |
212
+
213
+ ### Files
214
+
215
+ | Path | Contents |
216
+ | -------------------------------- | ---------------------------------------- |
217
+ | `~/.greptile/auth.json` | Credentials (refreshed automatically). |
218
+ | `~/.config/greptile/config.json` | Saved settings (`greptile config path`). |
219
+ | `~/.cache/greptile/` | Downloaded diagram renderer. |
@@ -0,0 +1,47 @@
1
+ {
2
+ "$id": "https://cdn.jsdelivr.net/npm/greptile@3/config-schema.json",
3
+ "title": "Greptile CLI settings",
4
+ "description": "Saved settings for the greptile CLI, normally managed with `greptile config set`. See `greptile config --help`.",
5
+ "type": "object",
6
+ "properties": {
7
+ "version": {
8
+ "type": "number",
9
+ "description": "Config file format version, written by the CLI."
10
+ },
11
+ "color": {
12
+ "type": "boolean",
13
+ "description": "Color output. Set to false for the same effect as always passing --no-color."
14
+ },
15
+ "review": {
16
+ "type": "object",
17
+ "properties": {
18
+ "output": {
19
+ "type": "string",
20
+ "enum": ["auto", "text", "json"],
21
+ "description": "Default review output: auto (rich on a terminal, text when piped), text, or json."
22
+ },
23
+ "layout": {
24
+ "type": "string",
25
+ "enum": ["comments", "diff"],
26
+ "description": "Default review layout: comments, or diff to show findings beside the changed code."
27
+ },
28
+ "context": {
29
+ "type": "integer",
30
+ "minimum": 0,
31
+ "maximum": 60,
32
+ "description": "Lines of nearby code shown around findings, the same as passing --context."
33
+ },
34
+ "width": {
35
+ "type": "integer",
36
+ "minimum": 40,
37
+ "maximum": 240,
38
+ "description": "Review output width in columns, the same as passing --width."
39
+ }
40
+ },
41
+ "additionalProperties": true,
42
+ "description": "Settings for greptile review."
43
+ }
44
+ },
45
+ "additionalProperties": true,
46
+ "$schema": "http://json-schema.org/draft-07/schema#"
47
+ }