@aaronshaf/ger 1.2.11 → 2.0.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/.ast-grep/rules/no-as-casting.yml +13 -0
- package/.claude-plugin/plugin.json +22 -0
- package/.github/workflows/ci-simple.yml +53 -0
- package/.github/workflows/ci.yml +171 -0
- package/.github/workflows/claude-code-review.yml +83 -0
- package/.github/workflows/claude.yml +50 -0
- package/.github/workflows/dependency-update.yml +84 -0
- package/.github/workflows/release.yml +166 -0
- package/.github/workflows/security-scan.yml +113 -0
- package/.github/workflows/security.yml +96 -0
- package/.husky/pre-commit +16 -0
- package/.husky/pre-push +25 -0
- package/.lintstagedrc.json +6 -0
- package/.tool-versions +1 -0
- package/CLAUDE.md +105 -0
- package/DEVELOPMENT.md +361 -0
- package/EXAMPLES.md +457 -0
- package/README.md +831 -16
- package/bin/ger +3 -18
- package/biome.json +36 -0
- package/bun.lock +678 -0
- package/bunfig.toml +8 -0
- package/docs/adr/0001-use-effect-for-side-effects.md +65 -0
- package/docs/adr/0002-use-bun-runtime.md +64 -0
- package/docs/adr/0003-store-credentials-in-home-directory.md +75 -0
- package/docs/adr/0004-use-commander-for-cli.md +76 -0
- package/docs/adr/0005-use-effect-schema-for-validation.md +93 -0
- package/docs/adr/0006-use-msw-for-api-mocking.md +89 -0
- package/docs/adr/0007-git-hooks-for-quality.md +94 -0
- package/docs/adr/0008-no-as-typecasting.md +83 -0
- package/docs/adr/0009-file-size-limits.md +82 -0
- package/docs/adr/0010-llm-friendly-xml-output.md +93 -0
- package/docs/adr/0011-ai-tool-strategy-pattern.md +102 -0
- package/docs/adr/0012-build-status-message-parsing.md +94 -0
- package/docs/adr/0013-git-subprocess-integration.md +98 -0
- package/docs/adr/0014-group-management-support.md +95 -0
- package/docs/adr/0015-batch-comment-processing.md +111 -0
- package/docs/adr/0016-flexible-change-identifiers.md +94 -0
- package/docs/adr/0017-git-worktree-support.md +102 -0
- package/docs/adr/0018-auto-install-commit-hook.md +103 -0
- package/docs/adr/0019-sdk-package-exports.md +95 -0
- package/docs/adr/0020-code-coverage-enforcement.md +105 -0
- package/docs/adr/0021-typescript-isolated-declarations.md +83 -0
- package/docs/adr/0022-biome-oxlint-tooling.md +124 -0
- package/docs/adr/README.md +30 -0
- package/docs/prd/README.md +12 -0
- package/docs/prd/architecture.md +325 -0
- package/docs/prd/commands.md +425 -0
- package/docs/prd/data-model.md +349 -0
- package/docs/prd/overview.md +124 -0
- package/index.ts +219 -0
- package/oxlint.json +24 -0
- package/package.json +82 -15
- package/scripts/check-coverage.ts +69 -0
- package/scripts/check-file-size.ts +38 -0
- package/scripts/fix-test-mocks.ts +55 -0
- package/skills/gerrit-workflow/SKILL.md +247 -0
- package/skills/gerrit-workflow/examples.md +572 -0
- package/skills/gerrit-workflow/reference.md +728 -0
- package/src/api/gerrit.ts +696 -0
- package/src/cli/commands/abandon.ts +65 -0
- package/src/cli/commands/add-reviewer.ts +156 -0
- package/src/cli/commands/build-status.ts +282 -0
- package/src/cli/commands/checkout.ts +422 -0
- package/src/cli/commands/comment.ts +460 -0
- package/src/cli/commands/comments.ts +85 -0
- package/src/cli/commands/diff.ts +71 -0
- package/src/cli/commands/extract-url.ts +266 -0
- package/src/cli/commands/groups-members.ts +104 -0
- package/src/cli/commands/groups-show.ts +169 -0
- package/src/cli/commands/groups.ts +137 -0
- package/src/cli/commands/incoming.ts +226 -0
- package/src/cli/commands/init.ts +164 -0
- package/src/cli/commands/mine.ts +115 -0
- package/src/cli/commands/open.ts +57 -0
- package/src/cli/commands/projects.ts +68 -0
- package/src/cli/commands/push.ts +430 -0
- package/src/cli/commands/rebase.ts +52 -0
- package/src/cli/commands/remove-reviewer.ts +123 -0
- package/src/cli/commands/restore.ts +50 -0
- package/src/cli/commands/review.ts +486 -0
- package/src/cli/commands/search.ts +162 -0
- package/src/cli/commands/setup.ts +286 -0
- package/src/cli/commands/show.ts +491 -0
- package/src/cli/commands/status.ts +35 -0
- package/src/cli/commands/submit.ts +108 -0
- package/src/cli/commands/vote.ts +119 -0
- package/src/cli/commands/workspace.ts +200 -0
- package/src/cli/index.ts +53 -0
- package/src/cli/register-commands.ts +659 -0
- package/src/cli/register-group-commands.ts +88 -0
- package/src/cli/register-reviewer-commands.ts +97 -0
- package/src/prompts/default-review.md +86 -0
- package/src/prompts/system-inline-review.md +135 -0
- package/src/prompts/system-overall-review.md +206 -0
- package/src/schemas/config.test.ts +245 -0
- package/src/schemas/config.ts +84 -0
- package/src/schemas/gerrit.ts +681 -0
- package/src/services/commit-hook.ts +314 -0
- package/src/services/config.test.ts +150 -0
- package/src/services/config.ts +250 -0
- package/src/services/git-worktree.ts +342 -0
- package/src/services/review-strategy.ts +292 -0
- package/src/test-utils/mock-generator.ts +138 -0
- package/src/utils/change-id.test.ts +98 -0
- package/src/utils/change-id.ts +63 -0
- package/src/utils/comment-formatters.ts +153 -0
- package/src/utils/diff-context.ts +103 -0
- package/src/utils/diff-formatters.ts +141 -0
- package/src/utils/formatters.ts +85 -0
- package/src/utils/git-commit.test.ts +277 -0
- package/src/utils/git-commit.ts +122 -0
- package/src/utils/index.ts +55 -0
- package/src/utils/message-filters.ts +26 -0
- package/src/utils/review-formatters.ts +89 -0
- package/src/utils/review-prompt-builder.ts +110 -0
- package/src/utils/shell-safety.ts +117 -0
- package/src/utils/status-indicators.ts +100 -0
- package/src/utils/url-parser.test.ts +271 -0
- package/src/utils/url-parser.ts +118 -0
- package/tests/abandon.test.ts +230 -0
- package/tests/add-reviewer.test.ts +579 -0
- package/tests/build-status-watch.test.ts +344 -0
- package/tests/build-status.test.ts +789 -0
- package/tests/change-id-formats.test.ts +268 -0
- package/tests/checkout/integration.test.ts +653 -0
- package/tests/checkout/parse-input.test.ts +55 -0
- package/tests/checkout/validation.test.ts +178 -0
- package/tests/comment-batch-advanced.test.ts +431 -0
- package/tests/comment-gerrit-api-compliance.test.ts +414 -0
- package/tests/comment.test.ts +708 -0
- package/tests/comments.test.ts +323 -0
- package/tests/config-service-simple.test.ts +100 -0
- package/tests/diff.test.ts +419 -0
- package/tests/extract-url.test.ts +517 -0
- package/tests/groups-members.test.ts +256 -0
- package/tests/groups-show.test.ts +323 -0
- package/tests/groups.test.ts +334 -0
- package/tests/helpers/build-status-test-setup.ts +83 -0
- package/tests/helpers/config-mock.ts +27 -0
- package/tests/incoming.test.ts +357 -0
- package/tests/init.test.ts +70 -0
- package/tests/integration/commit-hook.test.ts +246 -0
- package/tests/interactive-incoming.test.ts +173 -0
- package/tests/mine.test.ts +285 -0
- package/tests/mocks/msw-handlers.ts +80 -0
- package/tests/open.test.ts +233 -0
- package/tests/projects.test.ts +259 -0
- package/tests/rebase.test.ts +271 -0
- package/tests/remove-reviewer.test.ts +357 -0
- package/tests/restore.test.ts +237 -0
- package/tests/review.test.ts +135 -0
- package/tests/search.test.ts +712 -0
- package/tests/setup.test.ts +63 -0
- package/tests/show-auto-detect.test.ts +324 -0
- package/tests/show.test.ts +813 -0
- package/tests/status.test.ts +145 -0
- package/tests/submit.test.ts +316 -0
- package/tests/unit/commands/push.test.ts +194 -0
- package/tests/unit/git-branch-detection.test.ts +82 -0
- package/tests/unit/git-worktree.test.ts +55 -0
- package/tests/unit/patterns/push-patterns.test.ts +148 -0
- package/tests/unit/schemas/gerrit.test.ts +85 -0
- package/tests/unit/services/commit-hook.test.ts +132 -0
- package/tests/unit/services/review-strategy.test.ts +349 -0
- package/tests/unit/test-utils/mock-generator.test.ts +154 -0
- package/tests/unit/utils/comment-formatters.test.ts +415 -0
- package/tests/unit/utils/diff-context.test.ts +171 -0
- package/tests/unit/utils/diff-formatters.test.ts +165 -0
- package/tests/unit/utils/formatters.test.ts +411 -0
- package/tests/unit/utils/message-filters.test.ts +227 -0
- package/tests/unit/utils/shell-safety.test.ts +230 -0
- package/tests/unit/utils/status-indicators.test.ts +137 -0
- package/tests/vote.test.ts +317 -0
- package/tests/workspace.test.ts +295 -0
- package/tsconfig.json +36 -5
- package/src/commands/branch.ts +0 -196
- package/src/ger.ts +0 -22
- package/src/types.d.ts +0 -35
- package/src/utils.ts +0 -130
|
@@ -0,0 +1,728 @@
|
|
|
1
|
+
# ger CLI Command Reference
|
|
2
|
+
|
|
3
|
+
Complete reference documentation for all ger CLI commands.
|
|
4
|
+
|
|
5
|
+
## Change Viewing Commands
|
|
6
|
+
|
|
7
|
+
### show
|
|
8
|
+
|
|
9
|
+
Display comprehensive information about a Gerrit change.
|
|
10
|
+
|
|
11
|
+
**Syntax:**
|
|
12
|
+
```bash
|
|
13
|
+
ger show [change-id] [options]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Options:**
|
|
17
|
+
- `--format <format>` - Output format: `text`, `json`, `markdown`
|
|
18
|
+
- `--no-comments` - Exclude comments from output
|
|
19
|
+
- `--no-diff` - Exclude diff from output
|
|
20
|
+
|
|
21
|
+
**Examples:**
|
|
22
|
+
```bash
|
|
23
|
+
# Show current change
|
|
24
|
+
ger show
|
|
25
|
+
|
|
26
|
+
# Show specific change
|
|
27
|
+
ger show 12345
|
|
28
|
+
|
|
29
|
+
# Show as JSON
|
|
30
|
+
ger show 12345 --format json
|
|
31
|
+
|
|
32
|
+
# Show without comments
|
|
33
|
+
ger show --no-comments
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Output includes:**
|
|
37
|
+
- Change metadata (owner, status, subject)
|
|
38
|
+
- Commit message
|
|
39
|
+
- File diffs
|
|
40
|
+
- All comments and inline feedback
|
|
41
|
+
- Jenkins build status (if available)
|
|
42
|
+
|
|
43
|
+
### diff
|
|
44
|
+
|
|
45
|
+
Get the diff for a Gerrit change.
|
|
46
|
+
|
|
47
|
+
**Syntax:**
|
|
48
|
+
```bash
|
|
49
|
+
ger diff [change-id] [options]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Options:**
|
|
53
|
+
- `--format <format>` - Output format: `unified`, `context`, `json`
|
|
54
|
+
- `--file <path>` - Show diff for specific file only
|
|
55
|
+
- `--base <revision>` - Compare against specific base revision
|
|
56
|
+
|
|
57
|
+
**Examples:**
|
|
58
|
+
```bash
|
|
59
|
+
# Get unified diff
|
|
60
|
+
ger diff 12345
|
|
61
|
+
|
|
62
|
+
# Get diff for specific file
|
|
63
|
+
ger diff 12345 --file src/api/client.ts
|
|
64
|
+
|
|
65
|
+
# Get diff as JSON
|
|
66
|
+
ger diff 12345 --format json
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### comments
|
|
70
|
+
|
|
71
|
+
View all comments on a change.
|
|
72
|
+
|
|
73
|
+
**Syntax:**
|
|
74
|
+
```bash
|
|
75
|
+
ger comments [change-id] [options]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Options:**
|
|
79
|
+
- `--format <format>` - Output format: `text`, `json`, `markdown`
|
|
80
|
+
- `--unresolved-only` - Show only unresolved comments
|
|
81
|
+
- `--file <path>` - Show comments for specific file only
|
|
82
|
+
|
|
83
|
+
**Examples:**
|
|
84
|
+
```bash
|
|
85
|
+
# View all comments
|
|
86
|
+
ger comments 12345
|
|
87
|
+
|
|
88
|
+
# View unresolved comments only
|
|
89
|
+
ger comments 12345 --unresolved-only
|
|
90
|
+
|
|
91
|
+
# View comments for specific file
|
|
92
|
+
ger comments 12345 --file src/api/client.ts
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Change Management Commands
|
|
96
|
+
|
|
97
|
+
### mine
|
|
98
|
+
|
|
99
|
+
List all changes owned by you.
|
|
100
|
+
|
|
101
|
+
**Syntax:**
|
|
102
|
+
```bash
|
|
103
|
+
ger mine [options]
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Options:**
|
|
107
|
+
- `--status <status>` - Filter by status: `open`, `merged`, `abandoned`
|
|
108
|
+
- `--format <format>` - Output format: `table`, `json`, `list`
|
|
109
|
+
- `--limit <n>` - Limit number of results
|
|
110
|
+
|
|
111
|
+
**Examples:**
|
|
112
|
+
```bash
|
|
113
|
+
# List all your open changes
|
|
114
|
+
ger mine
|
|
115
|
+
|
|
116
|
+
# List merged changes
|
|
117
|
+
ger mine --status merged
|
|
118
|
+
|
|
119
|
+
# List as JSON
|
|
120
|
+
ger mine --format json
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### incoming
|
|
124
|
+
|
|
125
|
+
List changes that need your review.
|
|
126
|
+
|
|
127
|
+
**Syntax:**
|
|
128
|
+
```bash
|
|
129
|
+
ger incoming [options]
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Options:**
|
|
133
|
+
- `--format <format>` - Output format: `table`, `json`, `list`
|
|
134
|
+
- `--limit <n>` - Limit number of results
|
|
135
|
+
|
|
136
|
+
**Examples:**
|
|
137
|
+
```bash
|
|
138
|
+
# List incoming review requests
|
|
139
|
+
ger incoming
|
|
140
|
+
|
|
141
|
+
# Get as JSON
|
|
142
|
+
ger incoming --format json
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### open
|
|
146
|
+
|
|
147
|
+
List all open changes in the project.
|
|
148
|
+
|
|
149
|
+
**Syntax:**
|
|
150
|
+
```bash
|
|
151
|
+
ger open [options]
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Options:**
|
|
155
|
+
- `--owner <email>` - Filter by change owner
|
|
156
|
+
- `--format <format>` - Output format: `table`, `json`, `list`
|
|
157
|
+
- `--limit <n>` - Limit number of results
|
|
158
|
+
|
|
159
|
+
**Examples:**
|
|
160
|
+
```bash
|
|
161
|
+
# List all open changes
|
|
162
|
+
ger open
|
|
163
|
+
|
|
164
|
+
# Filter by owner
|
|
165
|
+
ger open --owner user@example.com
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### abandon
|
|
169
|
+
|
|
170
|
+
Mark a change as abandoned.
|
|
171
|
+
|
|
172
|
+
**Syntax:**
|
|
173
|
+
```bash
|
|
174
|
+
ger abandon [change-id] [options]
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Options:**
|
|
178
|
+
- `--message <text>` - Abandonment message
|
|
179
|
+
|
|
180
|
+
**Examples:**
|
|
181
|
+
```bash
|
|
182
|
+
# Abandon with message
|
|
183
|
+
ger abandon 12345 --message "No longer needed"
|
|
184
|
+
|
|
185
|
+
# Abandon current change
|
|
186
|
+
ger abandon
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### checkout
|
|
190
|
+
|
|
191
|
+
Checkout a specific change revision locally.
|
|
192
|
+
|
|
193
|
+
**Syntax:**
|
|
194
|
+
```bash
|
|
195
|
+
ger checkout <change-id> [options]
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Options:**
|
|
199
|
+
- `--revision <n>` - Checkout specific patchset revision (default: latest)
|
|
200
|
+
|
|
201
|
+
**Examples:**
|
|
202
|
+
```bash
|
|
203
|
+
# Checkout latest revision
|
|
204
|
+
ger checkout 12345
|
|
205
|
+
|
|
206
|
+
# Checkout specific revision
|
|
207
|
+
ger checkout 12345 --revision 3
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### push
|
|
211
|
+
|
|
212
|
+
Push changes to Gerrit for review.
|
|
213
|
+
|
|
214
|
+
**Syntax:**
|
|
215
|
+
```bash
|
|
216
|
+
ger push [options]
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**Options:**
|
|
220
|
+
- `-b, --branch <branch>` - Target branch (auto-detected from tracking branch)
|
|
221
|
+
- `-t, --topic <topic>` - Topic name
|
|
222
|
+
- `-r, --reviewer <email>` - Add reviewer (can be repeated)
|
|
223
|
+
- `--cc <email>` - Add CC (can be repeated)
|
|
224
|
+
- `--wip` - Mark as work-in-progress (not ready for review)
|
|
225
|
+
- `--ready` - Mark as ready for review (remove WIP status)
|
|
226
|
+
- `--hashtag <tag>` - Add hashtag (can be repeated)
|
|
227
|
+
- `--private` - Mark as private change
|
|
228
|
+
- `--draft` - Alias for --wip
|
|
229
|
+
- `--dry-run` - Preview push without actually pushing
|
|
230
|
+
|
|
231
|
+
**Examples:**
|
|
232
|
+
```bash
|
|
233
|
+
# Basic push to auto-detected branch
|
|
234
|
+
ger push
|
|
235
|
+
|
|
236
|
+
# Push to specific branch
|
|
237
|
+
ger push -b main
|
|
238
|
+
ger push --branch feature/auth
|
|
239
|
+
|
|
240
|
+
# Push with topic
|
|
241
|
+
ger push -t my-feature
|
|
242
|
+
|
|
243
|
+
# Push with reviewers
|
|
244
|
+
ger push -r alice@example.com -r bob@example.com
|
|
245
|
+
|
|
246
|
+
# Push with CC
|
|
247
|
+
ger push --cc manager@example.com
|
|
248
|
+
|
|
249
|
+
# Push as work-in-progress (WIP)
|
|
250
|
+
ger push --wip
|
|
251
|
+
|
|
252
|
+
# Mark change as ready for review
|
|
253
|
+
ger push --ready
|
|
254
|
+
|
|
255
|
+
# Add hashtag
|
|
256
|
+
ger push --hashtag bugfix
|
|
257
|
+
|
|
258
|
+
# Combine multiple options
|
|
259
|
+
ger push -b main -t refactor-auth -r alice@example.com --wip
|
|
260
|
+
|
|
261
|
+
# Preview push without executing
|
|
262
|
+
ger push --dry-run
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
**WIP Workflow:**
|
|
266
|
+
Work-in-progress changes are useful for getting early feedback or saving work:
|
|
267
|
+
```bash
|
|
268
|
+
# Push initial work as WIP
|
|
269
|
+
ger push --wip
|
|
270
|
+
|
|
271
|
+
# Continue updating (stays WIP)
|
|
272
|
+
ger push --wip
|
|
273
|
+
|
|
274
|
+
# Mark ready when complete
|
|
275
|
+
ger push --ready
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
**Features:**
|
|
279
|
+
- Auto-installs commit-msg hook if missing
|
|
280
|
+
- Auto-detects target branch from tracking branch or defaults to main/master
|
|
281
|
+
- Validates reviewer email addresses
|
|
282
|
+
- Returns change URL on successful push
|
|
283
|
+
|
|
284
|
+
### search
|
|
285
|
+
|
|
286
|
+
Search for changes using Gerrit query syntax.
|
|
287
|
+
|
|
288
|
+
**Syntax:**
|
|
289
|
+
```bash
|
|
290
|
+
ger search [query] [options]
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
**Options:**
|
|
294
|
+
- `-n, --limit <n>` - Maximum number of results (default: 25)
|
|
295
|
+
- `--format <format>` - Output format: `table`, `json`, `list`
|
|
296
|
+
- `--xml` - XML output for automation
|
|
297
|
+
|
|
298
|
+
**Common Query Operators:**
|
|
299
|
+
- `owner:USER` - Changes owned by USER (use 'self' for yourself)
|
|
300
|
+
- `status:STATE` - open, merged, abandoned, closed
|
|
301
|
+
- `project:NAME` - Changes in a specific project
|
|
302
|
+
- `branch:NAME` - Changes targeting a branch
|
|
303
|
+
- `age:TIME` - Time since last update (e.g., 1d, 2w, 1mon)
|
|
304
|
+
- `before:DATE` - Changes modified before date (YYYY-MM-DD)
|
|
305
|
+
- `after:DATE` - Changes modified after date (YYYY-MM-DD)
|
|
306
|
+
- `is:wip` - Work-in-progress changes
|
|
307
|
+
- `is:submittable` - Changes ready to submit
|
|
308
|
+
- `reviewer:USER` - Changes where USER is a reviewer
|
|
309
|
+
- `label:NAME=VALUE` - Filter by label (e.g., label:Code-Review+2)
|
|
310
|
+
|
|
311
|
+
**Examples:**
|
|
312
|
+
```bash
|
|
313
|
+
# Search for all open changes (default)
|
|
314
|
+
ger search
|
|
315
|
+
|
|
316
|
+
# Search for your open changes
|
|
317
|
+
ger search "owner:self status:open"
|
|
318
|
+
|
|
319
|
+
# Search for changes by a specific user
|
|
320
|
+
ger search "owner:john@example.com"
|
|
321
|
+
|
|
322
|
+
# Search by project
|
|
323
|
+
ger search "project:my-project status:open"
|
|
324
|
+
|
|
325
|
+
# Search with date filters
|
|
326
|
+
ger search "owner:self after:2025-01-01"
|
|
327
|
+
ger search "status:merged age:7d"
|
|
328
|
+
|
|
329
|
+
# Search for WIP changes
|
|
330
|
+
ger search "is:wip"
|
|
331
|
+
ger search "owner:self is:wip"
|
|
332
|
+
|
|
333
|
+
# Search for submittable changes
|
|
334
|
+
ger search "is:submittable"
|
|
335
|
+
|
|
336
|
+
# Combine filters
|
|
337
|
+
ger search "owner:self status:merged before:2025-06-01"
|
|
338
|
+
|
|
339
|
+
# Limit results
|
|
340
|
+
ger search "project:my-project" -n 10
|
|
341
|
+
|
|
342
|
+
# XML output for automation
|
|
343
|
+
ger search "owner:self" --xml
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
## Commenting Commands
|
|
347
|
+
|
|
348
|
+
### comment
|
|
349
|
+
|
|
350
|
+
Post a comment on a Gerrit change.
|
|
351
|
+
|
|
352
|
+
**Syntax:**
|
|
353
|
+
```bash
|
|
354
|
+
ger comment [change-id] [options]
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
**Options:**
|
|
358
|
+
- `-m, --message <text>` - Comment message
|
|
359
|
+
- `--file <path>` - File for inline comment
|
|
360
|
+
- `--line <n>` - Line number for inline comment
|
|
361
|
+
- `--unresolved` - Mark comment as unresolved (requiring action)
|
|
362
|
+
|
|
363
|
+
**Examples:**
|
|
364
|
+
```bash
|
|
365
|
+
# Post general comment
|
|
366
|
+
ger comment 12345 -m "Looks good!"
|
|
367
|
+
|
|
368
|
+
# Post inline comment
|
|
369
|
+
ger comment 12345 --file src/api/client.ts --line 42 -m "Consider error handling here"
|
|
370
|
+
|
|
371
|
+
# Mark as unresolved
|
|
372
|
+
ger comment 12345 -m "Please fix the type error" --unresolved
|
|
373
|
+
|
|
374
|
+
# Pipe input from stdin
|
|
375
|
+
echo "Review feedback from AI" | ger comment 12345
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
**Piped Input:**
|
|
379
|
+
The comment command accepts piped input, making it easy to integrate with AI tools:
|
|
380
|
+
```bash
|
|
381
|
+
# AI-generated review
|
|
382
|
+
cat diff.txt | ai-review-tool | ger comment 12345
|
|
383
|
+
|
|
384
|
+
# GPT-4 review
|
|
385
|
+
ger diff 12345 | gpt-4-review | ger comment 12345
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
## Build Integration Commands
|
|
389
|
+
|
|
390
|
+
### build-status
|
|
391
|
+
|
|
392
|
+
Check the build status for a change.
|
|
393
|
+
|
|
394
|
+
**Syntax:**
|
|
395
|
+
```bash
|
|
396
|
+
ger build-status [change-id] [options]
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
**Options:**
|
|
400
|
+
- `--watch` - Watch build status and wait for completion
|
|
401
|
+
- `--interval <seconds>` - Polling interval for watch mode (default: 30)
|
|
402
|
+
- `--timeout <seconds>` - Maximum wait time for watch mode
|
|
403
|
+
|
|
404
|
+
**Examples:**
|
|
405
|
+
```bash
|
|
406
|
+
# Check current status
|
|
407
|
+
ger build-status 12345
|
|
408
|
+
|
|
409
|
+
# Watch until build completes
|
|
410
|
+
ger build-status 12345 --watch
|
|
411
|
+
|
|
412
|
+
# Watch with custom interval and timeout
|
|
413
|
+
ger build-status 12345 --watch --interval 20 --timeout 1800
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### extract-url
|
|
417
|
+
|
|
418
|
+
Extract URLs from change metadata (e.g., build reports, Jenkins links).
|
|
419
|
+
|
|
420
|
+
**Syntax:**
|
|
421
|
+
```bash
|
|
422
|
+
ger extract-url <url-type> [change-id]
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
**URL Types:**
|
|
426
|
+
- `build-summary-report` - Jenkins build summary report
|
|
427
|
+
- `jenkins` - Main Jenkins build URL
|
|
428
|
+
- `test-results` - Test results URL
|
|
429
|
+
|
|
430
|
+
**Examples:**
|
|
431
|
+
```bash
|
|
432
|
+
# Extract build summary report URL
|
|
433
|
+
ger extract-url "build-summary-report"
|
|
434
|
+
|
|
435
|
+
# Extract for specific change
|
|
436
|
+
ger extract-url "jenkins" 12345
|
|
437
|
+
|
|
438
|
+
# Get the latest URL
|
|
439
|
+
ger extract-url "build-summary-report" | tail -1
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
## Configuration Commands
|
|
443
|
+
|
|
444
|
+
### config
|
|
445
|
+
|
|
446
|
+
Manage ger CLI configuration.
|
|
447
|
+
|
|
448
|
+
**Syntax:**
|
|
449
|
+
```bash
|
|
450
|
+
ger config <action> [key] [value]
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
**Actions:**
|
|
454
|
+
- `get <key>` - Get configuration value
|
|
455
|
+
- `set <key> <value>` - Set configuration value
|
|
456
|
+
- `list` - List all configuration
|
|
457
|
+
- `reset` - Reset to defaults
|
|
458
|
+
|
|
459
|
+
**Examples:**
|
|
460
|
+
```bash
|
|
461
|
+
# Set Gerrit URL
|
|
462
|
+
ger config set gerrit.url https://gerrit.example.com
|
|
463
|
+
|
|
464
|
+
# Get current URL
|
|
465
|
+
ger config get gerrit.url
|
|
466
|
+
|
|
467
|
+
# List all config
|
|
468
|
+
ger config list
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
## Groups and Reviewers Commands
|
|
472
|
+
|
|
473
|
+
### add-reviewer
|
|
474
|
+
|
|
475
|
+
Add reviewers, groups, or CCs to a change.
|
|
476
|
+
|
|
477
|
+
**Syntax:**
|
|
478
|
+
```bash
|
|
479
|
+
ger add-reviewer <reviewers...> -c <change-id> [options]
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
**Options:**
|
|
483
|
+
- `-c, --change <id>` - Change ID (required)
|
|
484
|
+
- `--group` - Add as group instead of individual reviewer
|
|
485
|
+
- `--cc` - Add as CC instead of reviewer
|
|
486
|
+
- `--notify <level>` - Notification level: `none`, `owner`, `owner_reviewers`, `all`
|
|
487
|
+
- `--xml` - XML output for automation
|
|
488
|
+
|
|
489
|
+
**Examples:**
|
|
490
|
+
```bash
|
|
491
|
+
# Add individual reviewers
|
|
492
|
+
ger add-reviewer user@example.com -c 12345
|
|
493
|
+
ger add-reviewer user1@example.com user2@example.com -c 12345
|
|
494
|
+
|
|
495
|
+
# Add a group as reviewer
|
|
496
|
+
ger add-reviewer --group project-reviewers -c 12345
|
|
497
|
+
|
|
498
|
+
# Add a group as CC
|
|
499
|
+
ger add-reviewer --group administrators --cc -c 12345
|
|
500
|
+
|
|
501
|
+
# Add as CC instead of reviewer
|
|
502
|
+
ger add-reviewer --cc user@example.com -c 12345
|
|
503
|
+
|
|
504
|
+
# Suppress notifications
|
|
505
|
+
ger add-reviewer --notify none user@example.com -c 12345
|
|
506
|
+
|
|
507
|
+
# XML output
|
|
508
|
+
ger add-reviewer user@example.com -c 12345 --xml
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
### groups
|
|
512
|
+
|
|
513
|
+
List and search Gerrit groups.
|
|
514
|
+
|
|
515
|
+
**Syntax:**
|
|
516
|
+
```bash
|
|
517
|
+
ger groups [options]
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
**Options:**
|
|
521
|
+
- `--pattern <regex>` - Filter groups by name pattern
|
|
522
|
+
- `--owned` - Show only groups you own
|
|
523
|
+
- `--project <name>` - Show groups for a specific project
|
|
524
|
+
- `--user <account>` - Show groups a user belongs to
|
|
525
|
+
- `--limit <n>` - Limit results (default: 25)
|
|
526
|
+
- `--xml` - XML output for automation
|
|
527
|
+
|
|
528
|
+
**Examples:**
|
|
529
|
+
```bash
|
|
530
|
+
# List all groups
|
|
531
|
+
ger groups
|
|
532
|
+
|
|
533
|
+
# Filter by pattern
|
|
534
|
+
ger groups --pattern "^project-.*"
|
|
535
|
+
|
|
536
|
+
# Show only owned groups
|
|
537
|
+
ger groups --owned
|
|
538
|
+
|
|
539
|
+
# Show groups for a project
|
|
540
|
+
ger groups --project my-project
|
|
541
|
+
|
|
542
|
+
# Limit results
|
|
543
|
+
ger groups --limit 50
|
|
544
|
+
|
|
545
|
+
# XML output
|
|
546
|
+
ger groups --xml
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
**Output includes:**
|
|
550
|
+
- Group name and ID
|
|
551
|
+
- Description
|
|
552
|
+
- Owner group
|
|
553
|
+
- Visibility settings
|
|
554
|
+
- Creation date (when available)
|
|
555
|
+
|
|
556
|
+
### groups-show
|
|
557
|
+
|
|
558
|
+
Show detailed information about a specific group.
|
|
559
|
+
|
|
560
|
+
**Syntax:**
|
|
561
|
+
```bash
|
|
562
|
+
ger groups-show <group-id> [options]
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
**Options:**
|
|
566
|
+
- `--xml` - XML output for automation
|
|
567
|
+
|
|
568
|
+
**Group ID formats:**
|
|
569
|
+
- Group name: `administrators`
|
|
570
|
+
- Numeric ID: `1`
|
|
571
|
+
- UUID: `uuid-123456`
|
|
572
|
+
|
|
573
|
+
**Examples:**
|
|
574
|
+
```bash
|
|
575
|
+
# Show by name
|
|
576
|
+
ger groups-show administrators
|
|
577
|
+
|
|
578
|
+
# Show by numeric ID
|
|
579
|
+
ger groups-show 1
|
|
580
|
+
|
|
581
|
+
# Show by UUID
|
|
582
|
+
ger groups-show uuid-123456
|
|
583
|
+
|
|
584
|
+
# XML output
|
|
585
|
+
ger groups-show administrators --xml
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
**Output includes:**
|
|
589
|
+
- Basic group information (name, ID, owner, description)
|
|
590
|
+
- Visibility settings
|
|
591
|
+
- All group members with details
|
|
592
|
+
- Subgroups (included groups)
|
|
593
|
+
- Metadata (creation date, group ID)
|
|
594
|
+
|
|
595
|
+
### groups-members
|
|
596
|
+
|
|
597
|
+
List all members of a group.
|
|
598
|
+
|
|
599
|
+
**Syntax:**
|
|
600
|
+
```bash
|
|
601
|
+
ger groups-members <group-id> [options]
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
**Options:**
|
|
605
|
+
- `--xml` - XML output for automation
|
|
606
|
+
|
|
607
|
+
**Examples:**
|
|
608
|
+
```bash
|
|
609
|
+
# List members
|
|
610
|
+
ger groups-members project-reviewers
|
|
611
|
+
|
|
612
|
+
# List members by numeric ID
|
|
613
|
+
ger groups-members 1
|
|
614
|
+
|
|
615
|
+
# XML output
|
|
616
|
+
ger groups-members project-reviewers --xml
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
**Output includes:**
|
|
620
|
+
- Member name
|
|
621
|
+
- Email address
|
|
622
|
+
- Username
|
|
623
|
+
- Account ID
|
|
624
|
+
|
|
625
|
+
**Notes:**
|
|
626
|
+
- All group commands are read-only
|
|
627
|
+
- Group operations do not support creating, modifying, or deleting groups
|
|
628
|
+
- Use with `add-reviewer --group` to add teams as reviewers
|
|
629
|
+
|
|
630
|
+
## Global Options
|
|
631
|
+
|
|
632
|
+
These options work with all commands:
|
|
633
|
+
|
|
634
|
+
- `--help` - Show help for command
|
|
635
|
+
- `--version` - Show ger version
|
|
636
|
+
- `--no-cache` - Skip cache and fetch fresh data
|
|
637
|
+
- `--debug` - Enable debug logging
|
|
638
|
+
- `--quiet` - Suppress non-essential output
|
|
639
|
+
|
|
640
|
+
**Examples:**
|
|
641
|
+
```bash
|
|
642
|
+
# Show help for a command
|
|
643
|
+
ger show --help
|
|
644
|
+
|
|
645
|
+
# Skip cache
|
|
646
|
+
ger mine --no-cache
|
|
647
|
+
|
|
648
|
+
# Enable debug mode
|
|
649
|
+
ger show 12345 --debug
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
## Exit Codes
|
|
653
|
+
|
|
654
|
+
- `0` - Success
|
|
655
|
+
- `1` - General error
|
|
656
|
+
- `2` - Invalid arguments
|
|
657
|
+
- `3` - API error
|
|
658
|
+
- `4` - Authentication error
|
|
659
|
+
- `5` - Not found error
|
|
660
|
+
|
|
661
|
+
## Environment Variables
|
|
662
|
+
|
|
663
|
+
- `GER_URL` - Gerrit server URL
|
|
664
|
+
- `GER_USERNAME` - Gerrit username
|
|
665
|
+
- `GER_PASSWORD` - Gerrit password/token
|
|
666
|
+
- `GER_CACHE_DIR` - Cache directory path (default: `~/.ger/cache`)
|
|
667
|
+
- `GER_LOG_LEVEL` - Log level: `debug`, `info`, `warn`, `error`
|
|
668
|
+
|
|
669
|
+
**Example:**
|
|
670
|
+
```bash
|
|
671
|
+
export GER_URL=https://gerrit.example.com
|
|
672
|
+
export GER_LOG_LEVEL=debug
|
|
673
|
+
ger mine
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
## Cache Behavior
|
|
677
|
+
|
|
678
|
+
The ger CLI uses SQLite for local-first caching:
|
|
679
|
+
|
|
680
|
+
- **Changes** - Cached for 5 minutes
|
|
681
|
+
- **Comments** - Cached for 2 minutes
|
|
682
|
+
- **Diffs** - Cached for 10 minutes
|
|
683
|
+
- **User data** - Cached for 1 hour
|
|
684
|
+
|
|
685
|
+
Use `--no-cache` to bypass cache and fetch fresh data.
|
|
686
|
+
|
|
687
|
+
## API Rate Limiting
|
|
688
|
+
|
|
689
|
+
The ger CLI respects Gerrit API rate limits:
|
|
690
|
+
|
|
691
|
+
- Maximum 100 requests per minute
|
|
692
|
+
- Automatic retry with exponential backoff
|
|
693
|
+
- Rate limit status shown in debug mode
|
|
694
|
+
|
|
695
|
+
## Error Handling
|
|
696
|
+
|
|
697
|
+
All commands use Effect Schema for validation and provide clear error messages:
|
|
698
|
+
|
|
699
|
+
```bash
|
|
700
|
+
# Invalid change ID
|
|
701
|
+
$ ger show invalid
|
|
702
|
+
Error: Invalid change ID format. Expected number or Change-Id string.
|
|
703
|
+
|
|
704
|
+
# Network error
|
|
705
|
+
$ ger mine
|
|
706
|
+
Error: Failed to connect to Gerrit server. Check your network connection.
|
|
707
|
+
|
|
708
|
+
# Permission error
|
|
709
|
+
$ ger abandon 12345
|
|
710
|
+
Error: Permission denied. You must be the change owner to abandon it.
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
## Internationalization
|
|
714
|
+
|
|
715
|
+
The ger CLI supports multiple languages via i18next. Set your locale:
|
|
716
|
+
|
|
717
|
+
```bash
|
|
718
|
+
export LANG=es_ES.UTF-8
|
|
719
|
+
ger mine
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
Supported languages:
|
|
723
|
+
- English (en)
|
|
724
|
+
- Spanish (es)
|
|
725
|
+
- French (fr)
|
|
726
|
+
- German (de)
|
|
727
|
+
- Japanese (ja)
|
|
728
|
+
- Chinese (zh)
|