@aaronshaf/ger 4.0.0 → 4.0.1
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/package.json +1 -1
- package/skills/gerrit-workflow/SKILL.md +228 -141
- package/skills/gerrit-workflow/examples.md +133 -426
- package/skills/gerrit-workflow/reference.md +470 -408
- package/src/cli/index.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: gerrit-workflow
|
|
3
|
-
description: Work with Gerrit code reviews using the ger CLI tool. Use when reviewing changes, posting comments, managing patches, or interacting with Gerrit. Covers common workflows like fetching changes, viewing diffs, adding comments,
|
|
3
|
+
description: Work with Gerrit code reviews using the ger CLI tool. Use when reviewing changes, posting comments, managing patches, or interacting with Gerrit. Covers common workflows like fetching changes, viewing diffs, adding comments, voting, managing change status, cherry-picking, and tree worktrees.
|
|
4
4
|
allowed-tools: Bash, Read, Write, Edit, Grep, Glob
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -12,6 +12,15 @@ This skill helps you work effectively with Gerrit code reviews using the `ger` C
|
|
|
12
12
|
|
|
13
13
|
The `ger` CLI tool must be installed and accessible in your PATH. It's available globally if installed from `~/github/ger`.
|
|
14
14
|
|
|
15
|
+
## Output Formats
|
|
16
|
+
|
|
17
|
+
Most commands support `--json` and `--xml` flags:
|
|
18
|
+
- `--json` — Structured JSON for programmatic consumption
|
|
19
|
+
- `--xml` — XML with CDATA-wrapped content, optimized for LLM/AI consumption
|
|
20
|
+
- (default) — Plain text / colored terminal output for humans
|
|
21
|
+
|
|
22
|
+
These are mutually exclusive; using both is an error.
|
|
23
|
+
|
|
15
24
|
## Core Commands
|
|
16
25
|
|
|
17
26
|
### Viewing Changes
|
|
@@ -20,228 +29,306 @@ The `ger` CLI tool must be installed and accessible in your PATH. It's available
|
|
|
20
29
|
```bash
|
|
21
30
|
ger show [change-id]
|
|
22
31
|
```
|
|
23
|
-
Displays metadata, diff, and all comments
|
|
32
|
+
Displays metadata, diff, and all comments. Auto-detects from HEAD commit if omitted.
|
|
24
33
|
|
|
25
34
|
**View specific diff:**
|
|
26
35
|
```bash
|
|
27
36
|
ger diff [change-id]
|
|
37
|
+
ger diff [change-id] --file src/api/client.ts # specific file
|
|
28
38
|
```
|
|
29
|
-
Get diffs with various formatting options.
|
|
30
39
|
|
|
31
40
|
**View all comments:**
|
|
32
41
|
```bash
|
|
33
42
|
ger comments [change-id]
|
|
43
|
+
ger comments [change-id] --unresolved-only
|
|
34
44
|
```
|
|
35
|
-
View all comments on a change with context.
|
|
36
45
|
|
|
37
|
-
|
|
46
|
+
**List changed files:**
|
|
47
|
+
```bash
|
|
48
|
+
ger files [change-id]
|
|
49
|
+
ger files [change-id] --json
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**List reviewers:**
|
|
53
|
+
```bash
|
|
54
|
+
ger reviewers [change-id]
|
|
55
|
+
ger reviewers [change-id] --xml
|
|
56
|
+
```
|
|
38
57
|
|
|
39
|
-
|
|
58
|
+
### Listing Changes
|
|
59
|
+
|
|
60
|
+
**Your open changes:**
|
|
40
61
|
```bash
|
|
41
62
|
ger mine
|
|
63
|
+
ger list
|
|
42
64
|
```
|
|
43
|
-
List all changes owned by you.
|
|
44
65
|
|
|
45
|
-
**
|
|
66
|
+
**Changes needing your review (reviewer OR cc'd):**
|
|
46
67
|
```bash
|
|
47
68
|
ger incoming
|
|
69
|
+
ger team
|
|
48
70
|
```
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
71
|
+
Both query `reviewer:self OR cc:self status:open`. Options:
|
|
72
|
+
- `--all-verified` — Include all verification states (default: open only)
|
|
73
|
+
- `-f, --filter <query>` — Append custom Gerrit query syntax
|
|
74
|
+
- `--status <status>` — Filter by status: open, merged, abandoned
|
|
75
|
+
- `-n, --limit <n>` — Limit number of results (default: 25)
|
|
76
|
+
- `--detailed` — Show detailed info for each change
|
|
77
|
+
- `--json` / `--xml`
|
|
78
|
+
|
|
79
|
+
**General list with options:**
|
|
52
80
|
```bash
|
|
53
|
-
ger
|
|
81
|
+
ger list --status merged
|
|
82
|
+
ger list --reviewer # same as incoming
|
|
83
|
+
ger list -n 10 --json
|
|
54
84
|
```
|
|
55
|
-
List all open changes in the project.
|
|
56
85
|
|
|
57
|
-
**
|
|
86
|
+
**Search with custom query:**
|
|
58
87
|
```bash
|
|
59
|
-
ger
|
|
88
|
+
ger search "owner:self is:wip"
|
|
89
|
+
ger search "project:my-project status:open" -n 10 --xml
|
|
60
90
|
```
|
|
61
|
-
Mark a change as abandoned.
|
|
62
91
|
|
|
63
|
-
###
|
|
92
|
+
### Posting Comments and Votes
|
|
64
93
|
|
|
65
|
-
**
|
|
94
|
+
**Post a comment:**
|
|
66
95
|
```bash
|
|
67
|
-
ger
|
|
96
|
+
ger comment [change-id] -m "Your comment"
|
|
97
|
+
echo "Review feedback" | ger comment [change-id] # from stdin
|
|
98
|
+
ger comment [change-id] --file src/api/client.ts --line 42 -m "Inline comment"
|
|
68
99
|
```
|
|
69
100
|
|
|
70
|
-
**
|
|
101
|
+
**Vote on a change:**
|
|
71
102
|
```bash
|
|
72
|
-
|
|
73
|
-
ger
|
|
74
|
-
|
|
75
|
-
# Push with topic
|
|
76
|
-
ger push -t my-feature
|
|
103
|
+
ger vote [change-id] Code-Review +2
|
|
104
|
+
ger vote [change-id] Verified -1
|
|
105
|
+
```
|
|
77
106
|
|
|
78
|
-
|
|
79
|
-
ger push -r alice@example.com -r bob@example.com
|
|
107
|
+
### Managing Changes
|
|
80
108
|
|
|
81
|
-
|
|
82
|
-
|
|
109
|
+
**Abandon / restore:**
|
|
110
|
+
```bash
|
|
111
|
+
ger abandon [change-id] -m "No longer needed"
|
|
112
|
+
ger restore [change-id]
|
|
113
|
+
```
|
|
83
114
|
|
|
84
|
-
|
|
85
|
-
|
|
115
|
+
**Submit a change:**
|
|
116
|
+
```bash
|
|
117
|
+
ger submit [change-id]
|
|
118
|
+
```
|
|
86
119
|
|
|
87
|
-
|
|
88
|
-
|
|
120
|
+
**Set WIP / Ready:**
|
|
121
|
+
```bash
|
|
122
|
+
ger set-wip [change-id]
|
|
123
|
+
ger set-wip [change-id] -m "Still working on tests"
|
|
124
|
+
ger set-ready [change-id]
|
|
125
|
+
ger set-ready [change-id] -m "Ready for review"
|
|
89
126
|
```
|
|
90
127
|
|
|
91
|
-
**
|
|
92
|
-
Work-in-progress changes are useful when you want to push changes that aren't ready for review:
|
|
128
|
+
**Topic:**
|
|
93
129
|
```bash
|
|
94
|
-
|
|
95
|
-
ger
|
|
130
|
+
ger topic [change-id] # get current topic
|
|
131
|
+
ger topic [change-id] my-topic # set topic
|
|
132
|
+
ger topic [change-id] --delete # delete topic
|
|
133
|
+
```
|
|
96
134
|
|
|
97
|
-
|
|
98
|
-
ger push --wip
|
|
135
|
+
### Pushing Changes
|
|
99
136
|
|
|
100
|
-
|
|
101
|
-
|
|
137
|
+
**Push changes to Gerrit:**
|
|
138
|
+
```bash
|
|
139
|
+
ger push
|
|
140
|
+
ger push -b main -t my-feature -r alice@example.com --wip
|
|
102
141
|
```
|
|
142
|
+
Options: `-b`, `-t`, `-r`, `--cc`, `--wip`, `--ready`, `--hashtag`, `--private`, `--dry-run`
|
|
103
143
|
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
# Find all WIP changes
|
|
107
|
-
ger search "is:wip"
|
|
144
|
+
### Checkout and Cherry-Pick
|
|
108
145
|
|
|
109
|
-
|
|
110
|
-
|
|
146
|
+
**Checkout a change locally:**
|
|
147
|
+
```bash
|
|
148
|
+
ger checkout 12345
|
|
149
|
+
ger checkout 12345 --revision 3 # specific patchset
|
|
111
150
|
```
|
|
112
151
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
**Post a comment:**
|
|
152
|
+
**Cherry-pick a change into current branch:**
|
|
116
153
|
```bash
|
|
117
|
-
ger
|
|
154
|
+
ger cherry 12345
|
|
155
|
+
ger cherry 12345/3 # specific patchset
|
|
156
|
+
ger cherry 12345 --no-commit # stage without committing
|
|
157
|
+
ger cherry 12345 --no-verify # skip pre-commit hooks
|
|
158
|
+
ger cherry https://gerrit.example.com/c/my-project/+/12345
|
|
118
159
|
```
|
|
119
160
|
|
|
120
|
-
|
|
161
|
+
### Rebase
|
|
162
|
+
|
|
163
|
+
**Rebase a change on Gerrit (server-side):**
|
|
121
164
|
```bash
|
|
122
|
-
|
|
165
|
+
ger rebase [change-id]
|
|
166
|
+
ger rebase [change-id] --base <sha-or-change>
|
|
167
|
+
ger rebase [change-id] --allow-conflicts # rebase even with conflicts
|
|
168
|
+
ger rebase [change-id] --json
|
|
123
169
|
```
|
|
170
|
+
Auto-detects from HEAD commit if no change-id provided.
|
|
171
|
+
|
|
172
|
+
### Retrigger CI
|
|
124
173
|
|
|
125
|
-
**Post
|
|
174
|
+
**Post a CI retrigger comment:**
|
|
126
175
|
```bash
|
|
127
|
-
ger
|
|
176
|
+
ger retrigger [change-id]
|
|
128
177
|
```
|
|
178
|
+
Auto-detects from HEAD. Saves the retrigger comment to config on first use (or configure via `ger setup`).
|
|
129
179
|
|
|
130
|
-
|
|
180
|
+
### Build Status
|
|
131
181
|
|
|
132
|
-
|
|
182
|
+
**Check Jenkins build status:**
|
|
183
|
+
```bash
|
|
184
|
+
ger build-status [change-id]
|
|
185
|
+
ger build-status --watch --interval 20 --timeout 1800
|
|
186
|
+
ger build-status --exit-status # non-zero exit on failure (for scripting)
|
|
187
|
+
```
|
|
133
188
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
189
|
+
**Extract build URLs:**
|
|
190
|
+
```bash
|
|
191
|
+
ger extract-url "build-summary-report"
|
|
192
|
+
ger extract-url "build-summary-report" | tail -1
|
|
193
|
+
```
|
|
138
194
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
195
|
+
**Canonical CI workflow:**
|
|
196
|
+
```bash
|
|
197
|
+
ger build-status --watch --interval 20 --timeout 1800 && \
|
|
198
|
+
ger extract-url "build-summary-report" | tail -1 | jk failures --smart --xml
|
|
199
|
+
```
|
|
143
200
|
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
ger comment [change-id] -m "LGTM! Great work on the refactoring."
|
|
147
|
-
```
|
|
201
|
+
### Analytics
|
|
148
202
|
|
|
149
|
-
|
|
203
|
+
**View merged change analytics (year-to-date by default):**
|
|
204
|
+
```bash
|
|
205
|
+
ger analyze
|
|
206
|
+
ger analyze --start-date 2025-01-01 --end-date 2025-12-31
|
|
207
|
+
ger analyze --repo canvas-lms
|
|
208
|
+
ger analyze --json
|
|
209
|
+
ger analyze --xml
|
|
210
|
+
ger analyze --markdown
|
|
211
|
+
ger analyze --csv
|
|
212
|
+
ger analyze --output report.md # write to file
|
|
213
|
+
```
|
|
214
|
+
Default start date: January 1 of current year.
|
|
150
215
|
|
|
151
|
-
|
|
216
|
+
**Update local cache of merged changes:**
|
|
217
|
+
```bash
|
|
218
|
+
ger update
|
|
219
|
+
ger update --since 2025-01-01
|
|
220
|
+
```
|
|
152
221
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
222
|
+
**View recent failures summary:**
|
|
223
|
+
```bash
|
|
224
|
+
ger failures
|
|
225
|
+
ger failures --xml
|
|
226
|
+
```
|
|
157
227
|
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
# AI analyzes the diff and generates feedback
|
|
161
|
-
ai-tool analyze /tmp/review.diff | ger comment [change-id]
|
|
162
|
-
```
|
|
228
|
+
### Worktree (tree) Commands
|
|
163
229
|
|
|
164
|
-
|
|
230
|
+
Manage git worktrees for reviewing changes in isolation.
|
|
165
231
|
|
|
166
|
-
|
|
232
|
+
**Setup a worktree for a change:**
|
|
233
|
+
```bash
|
|
234
|
+
ger tree setup 12345
|
|
235
|
+
ger tree setup 12345:3 # specific patchset
|
|
236
|
+
ger tree setup 12345 --xml
|
|
237
|
+
```
|
|
238
|
+
Creates worktree at `<repo-root>/.ger/<change-number>/`.
|
|
167
239
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
240
|
+
**List ger-managed worktrees:**
|
|
241
|
+
```bash
|
|
242
|
+
ger trees
|
|
243
|
+
ger trees --json
|
|
244
|
+
```
|
|
173
245
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
246
|
+
**Rebase a worktree (run from inside the worktree):**
|
|
247
|
+
```bash
|
|
248
|
+
cd .ger/12345
|
|
249
|
+
ger tree rebase
|
|
250
|
+
ger tree rebase --onto origin/main
|
|
251
|
+
ger tree rebase --interactive # interactive rebase (-i)
|
|
252
|
+
```
|
|
177
253
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
git commit --amend
|
|
254
|
+
**Remove a worktree:**
|
|
255
|
+
```bash
|
|
256
|
+
ger tree cleanup 12345
|
|
257
|
+
```
|
|
183
258
|
|
|
184
|
-
|
|
185
|
-
ger push --wip
|
|
186
|
-
```
|
|
259
|
+
### Groups and Reviewers
|
|
187
260
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
261
|
+
**Add reviewers:**
|
|
262
|
+
```bash
|
|
263
|
+
ger add-reviewer user@example.com -c 12345
|
|
264
|
+
ger add-reviewer --group project-reviewers -c 12345
|
|
265
|
+
ger add-reviewer --cc user@example.com -c 12345
|
|
266
|
+
ger add-reviewer --notify none user@example.com -c 12345
|
|
267
|
+
```
|
|
193
268
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
269
|
+
**Remove reviewers:**
|
|
270
|
+
```bash
|
|
271
|
+
ger remove-reviewer user@example.com -c 12345
|
|
272
|
+
```
|
|
197
273
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
274
|
+
**List groups:**
|
|
275
|
+
```bash
|
|
276
|
+
ger groups
|
|
277
|
+
ger groups --pattern "^team-.*"
|
|
278
|
+
ger groups --project canvas-lms
|
|
279
|
+
ger groups --owned
|
|
280
|
+
```
|
|
203
281
|
|
|
204
|
-
|
|
282
|
+
**Show group details / members:**
|
|
283
|
+
```bash
|
|
284
|
+
ger groups-show administrators
|
|
285
|
+
ger groups-members project-reviewers
|
|
286
|
+
```
|
|
205
287
|
|
|
206
|
-
###
|
|
288
|
+
### Configuration and Setup
|
|
207
289
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
290
|
+
```bash
|
|
291
|
+
ger setup # interactive first-time setup
|
|
292
|
+
ger config list # list all config
|
|
293
|
+
ger config get gerrit.url
|
|
294
|
+
ger config set gerrit.url https://gerrit.example.com
|
|
295
|
+
```
|
|
212
296
|
|
|
213
|
-
|
|
297
|
+
## Auto-Detection
|
|
214
298
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
3. **Use meaningful commit messages** - follow conventional commit format
|
|
218
|
-
4. **Test before submitting** - ensure builds pass before requesting review
|
|
219
|
-
5. **Consider WIP flag (optional)** - use `--wip` for changes not ready for review
|
|
299
|
+
These commands auto-detect the change from the HEAD commit's `Change-Id` footer when no change-id is provided:
|
|
300
|
+
`show`, `build-status`, `topic`, `rebase`, `extract-url`, `diff`, `comments`, `vote`, `retrigger`, `files`, `reviewers`
|
|
220
301
|
|
|
221
|
-
##
|
|
302
|
+
## Common LLM Workflows
|
|
222
303
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
304
|
+
```bash
|
|
305
|
+
# Review a change
|
|
306
|
+
ger show <id> --xml
|
|
307
|
+
ger diff <id> --xml
|
|
308
|
+
ger comments <id> --xml
|
|
227
309
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
- Ensure you're added as a reviewer (for private changes)
|
|
310
|
+
# Post a review
|
|
311
|
+
ger comment <id> -m "..."
|
|
312
|
+
ger vote <id> Code-Review +1
|
|
232
313
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
314
|
+
# Manage changes
|
|
315
|
+
ger push
|
|
316
|
+
ger checkout <id>
|
|
317
|
+
ger abandon <id>
|
|
318
|
+
ger submit <id>
|
|
237
319
|
|
|
238
|
-
|
|
320
|
+
# WIP toggle
|
|
321
|
+
ger set-wip <id>
|
|
322
|
+
ger set-ready <id> -m "message"
|
|
239
323
|
|
|
240
|
-
|
|
324
|
+
# Check CI
|
|
325
|
+
ger build-status <id> --exit-status
|
|
326
|
+
```
|
|
241
327
|
|
|
242
328
|
## Notes
|
|
243
329
|
|
|
244
|
-
- Commands
|
|
245
|
-
- Most commands accept an optional change-id; if omitted, they use the current branch
|
|
330
|
+
- Commands run from within a Gerrit repository
|
|
331
|
+
- Most commands accept an optional change-id; if omitted, they use the current branch's HEAD `Change-Id`
|
|
246
332
|
- The tool uses local SQLite caching for offline-first functionality
|
|
247
|
-
-
|
|
333
|
+
- `--xml` is preferred over `--json` for LLM/AI consumption (easier to parse)
|
|
334
|
+
- Numeric change numbers (12345) and full Change-IDs (I1234abc...) are both accepted
|