@aaronshaf/ger 2.0.7 → 2.0.9

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/README.md CHANGED
@@ -18,6 +18,14 @@ curl -fsSL https://bun.sh/install | bash
18
18
  bun install -g @aaronshaf/ger
19
19
  ```
20
20
 
21
+ ## Upgrading
22
+
23
+ To upgrade ger to the latest version:
24
+
25
+ ```bash
26
+ bun update -g @aaronshaf/ger
27
+ ```
28
+
21
29
  ## Getting Started
22
30
 
23
31
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aaronshaf/ger",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "description": "Gerrit CLI and SDK - A modern CLI tool and TypeScript SDK for Gerrit Code Review, built with Effect-TS",
5
5
  "keywords": [
6
6
  "gerrit",
@@ -19,8 +19,34 @@ export const GerritCredentials: Schema.Schema<{
19
19
  ),
20
20
  })
21
21
  export type GerritCredentials = Schema.Schema.Type<typeof GerritCredentials>
22
+ export const FileInfo: Schema.Schema<{
23
+ readonly status?: 'A' | 'D' | 'R' | 'C' | 'M'
24
+ readonly lines_inserted?: number
25
+ readonly lines_deleted?: number
26
+ readonly size?: number
27
+ readonly size_delta?: number
28
+ readonly old_path?: string
29
+ readonly binary?: boolean
30
+ }> = Schema.Struct({
31
+ status: Schema.optional(Schema.Literal('A', 'D', 'R', 'C', 'M')), // Added, Deleted, Renamed, Copied, Modified
32
+ lines_inserted: Schema.optional(Schema.Number),
33
+ lines_deleted: Schema.optional(Schema.Number),
34
+ size_delta: Schema.optional(Schema.Number),
35
+ size: Schema.optional(Schema.Number),
36
+ old_path: Schema.optional(Schema.String),
37
+ binary: Schema.optional(Schema.Boolean),
38
+ })
39
+ export type FileInfo = Schema.Schema.Type<typeof FileInfo>
22
40
 
23
- export interface RevisionInfoType {
41
+ type PersonDate = { readonly name: string; readonly email: string; readonly date: string }
42
+ type ChangeMessage = {
43
+ readonly id: string
44
+ readonly message: string
45
+ readonly date: string
46
+ readonly _revision_number?: number
47
+ readonly tag?: string
48
+ }
49
+ type RevisionShape = {
24
50
  readonly kind?: string
25
51
  readonly _number: number
26
52
  readonly created: string
@@ -28,39 +54,21 @@ export interface RevisionInfoType {
28
54
  readonly _account_id: number
29
55
  readonly name?: string
30
56
  readonly email?: string
57
+ readonly username?: string
31
58
  }
32
59
  readonly ref: string
33
60
  readonly fetch?: Record<string, unknown>
61
+ readonly description?: string
34
62
  readonly commit?: {
35
63
  readonly commit: string
36
- readonly parents: ReadonlyArray<{
37
- readonly commit: string
38
- readonly subject: string
39
- }>
40
- readonly author: {
41
- readonly name: string
42
- readonly email: string
43
- readonly date: string
44
- }
45
- readonly committer: {
46
- readonly name: string
47
- readonly email: string
48
- readonly date: string
49
- }
64
+ readonly parents: ReadonlyArray<{ readonly commit: string; readonly subject: string }>
65
+ readonly author: PersonDate
66
+ readonly committer: PersonDate
50
67
  readonly subject: string
51
68
  readonly message: string
52
69
  }
53
- readonly files?: Record<
54
- string,
55
- {
56
- readonly status?: 'A' | 'D' | 'R' | 'C' | 'M'
57
- readonly lines_inserted?: number
58
- readonly lines_deleted?: number
59
- readonly size?: number
60
- readonly size_delta?: number
61
- readonly old_path?: string
62
- }
63
- >
70
+ readonly files?: Record<string, FileInfo>
71
+ readonly actions?: Record<string, unknown>
64
72
  }
65
73
 
66
74
  type ChangeReviewerAccount = {
@@ -68,16 +76,41 @@ type ChangeReviewerAccount = {
68
76
  readonly name?: string
69
77
  readonly email?: string
70
78
  readonly username?: string
79
+ readonly display_name?: string
80
+ readonly tags?: ReadonlyArray<string>
71
81
  }
72
82
  const ChangeReviewerAccountInfo: Schema.Schema<ChangeReviewerAccount> = Schema.Struct({
73
83
  _account_id: Schema.optional(Schema.Number),
74
84
  name: Schema.optional(Schema.String),
75
85
  email: Schema.optional(Schema.String),
76
86
  username: Schema.optional(Schema.String),
87
+ display_name: Schema.optional(Schema.String),
88
+ tags: Schema.optional(Schema.Array(Schema.String)),
77
89
  })
78
90
  type ChangeReviewerMap = Partial<
79
91
  Record<'REVIEWER' | 'CC' | 'REMOVED', ReadonlyArray<ChangeReviewerAccount>>
80
92
  >
93
+ // Account/User schema (reusable for groups and reviewers)
94
+ export const AccountInfo: Schema.Schema<{
95
+ readonly _account_id: number
96
+ readonly name?: string
97
+ readonly email?: string
98
+ readonly username?: string
99
+ readonly display_name?: string
100
+ readonly tags?: ReadonlyArray<string>
101
+ readonly inactive?: boolean
102
+ readonly status?: string
103
+ }> = Schema.Struct({
104
+ _account_id: Schema.Number,
105
+ name: Schema.optional(Schema.String),
106
+ email: Schema.optional(Schema.String),
107
+ username: Schema.optional(Schema.String),
108
+ display_name: Schema.optional(Schema.String),
109
+ tags: Schema.optional(Schema.Array(Schema.String)),
110
+ inactive: Schema.optional(Schema.Boolean),
111
+ status: Schema.optional(Schema.String),
112
+ })
113
+ export type AccountInfo = Schema.Schema.Type<typeof AccountInfo>
81
114
 
82
115
  export const ChangeInfo: Schema.Schema<{
83
116
  readonly id: string
@@ -88,51 +121,35 @@ export const ChangeInfo: Schema.Schema<{
88
121
  readonly status: 'NEW' | 'MERGED' | 'ABANDONED' | 'DRAFT'
89
122
  readonly created?: string
90
123
  readonly updated?: string
124
+ readonly submitted?: string
91
125
  readonly insertions?: number
92
126
  readonly deletions?: number
93
127
  readonly _number: number
94
- readonly owner?: {
95
- readonly _account_id: number
96
- readonly name?: string
97
- readonly email?: string
98
- readonly username?: string
99
- }
128
+ readonly owner?: AccountInfo
100
129
  readonly labels?: Record<
101
130
  string,
102
131
  {
103
- readonly approved?: {
104
- readonly _account_id: number
105
- readonly name?: string
106
- readonly email?: string
107
- readonly username?: string
108
- }
109
- readonly rejected?: {
110
- readonly _account_id: number
111
- readonly name?: string
112
- readonly email?: string
113
- readonly username?: string
114
- }
115
- readonly recommended?: {
116
- readonly _account_id: number
117
- readonly name?: string
118
- readonly email?: string
119
- readonly username?: string
120
- }
121
- readonly disliked?: {
122
- readonly _account_id: number
123
- readonly name?: string
124
- readonly email?: string
125
- readonly username?: string
126
- }
132
+ readonly approved?: AccountInfo
133
+ readonly rejected?: AccountInfo
134
+ readonly recommended?: AccountInfo
135
+ readonly disliked?: AccountInfo
127
136
  readonly value?: number
128
137
  }
129
138
  >
130
139
  readonly submittable?: boolean
131
140
  readonly work_in_progress?: boolean
141
+ readonly is_private?: boolean
132
142
  readonly current_revision?: string
133
- readonly revisions?: Record<string, RevisionInfoType>
143
+ readonly revisions?: Record<string, RevisionShape>
134
144
  readonly topic?: string
145
+ readonly hashtags?: ReadonlyArray<string>
135
146
  readonly reviewers?: ChangeReviewerMap
147
+ readonly mergeable?: boolean
148
+ readonly unresolved_comment_count?: number
149
+ readonly total_comment_count?: number
150
+ readonly attention_set?: Record<string, unknown>
151
+ readonly submit_type?: string
152
+ readonly messages?: ReadonlyArray<ChangeMessage>
136
153
  }> = Schema.Struct({
137
154
  id: Schema.String,
138
155
  project: Schema.String,
@@ -142,62 +159,52 @@ export const ChangeInfo: Schema.Schema<{
142
159
  status: Schema.Literal('NEW', 'MERGED', 'ABANDONED', 'DRAFT'),
143
160
  created: Schema.optional(Schema.String),
144
161
  updated: Schema.optional(Schema.String),
162
+ submitted: Schema.optional(Schema.String),
145
163
  insertions: Schema.optional(Schema.Number),
146
164
  deletions: Schema.optional(Schema.Number),
147
165
  _number: Schema.Number,
148
- owner: Schema.optional(
149
- Schema.Struct({
150
- _account_id: Schema.Number,
151
- name: Schema.optional(Schema.String),
152
- email: Schema.optional(Schema.String),
153
- username: Schema.optional(Schema.String),
154
- }),
155
- ),
166
+ owner: Schema.optional(AccountInfo),
156
167
  labels: Schema.optional(
157
168
  Schema.Record({
158
169
  key: Schema.String,
159
170
  value: Schema.Struct({
160
- approved: Schema.optional(
161
- Schema.Struct({
162
- _account_id: Schema.Number,
163
- name: Schema.optional(Schema.String),
164
- email: Schema.optional(Schema.String),
165
- username: Schema.optional(Schema.String),
166
- }),
167
- ),
168
- rejected: Schema.optional(
169
- Schema.Struct({
170
- _account_id: Schema.Number,
171
- name: Schema.optional(Schema.String),
172
- email: Schema.optional(Schema.String),
173
- username: Schema.optional(Schema.String),
174
- }),
175
- ),
176
- recommended: Schema.optional(
177
- Schema.Struct({
178
- _account_id: Schema.Number,
179
- name: Schema.optional(Schema.String),
180
- email: Schema.optional(Schema.String),
181
- username: Schema.optional(Schema.String),
182
- }),
183
- ),
184
- disliked: Schema.optional(
185
- Schema.Struct({
186
- _account_id: Schema.Number,
187
- name: Schema.optional(Schema.String),
188
- email: Schema.optional(Schema.String),
189
- username: Schema.optional(Schema.String),
190
- }),
191
- ),
171
+ approved: Schema.optional(AccountInfo),
172
+ rejected: Schema.optional(AccountInfo),
173
+ recommended: Schema.optional(AccountInfo),
174
+ disliked: Schema.optional(AccountInfo),
192
175
  value: Schema.optional(Schema.Number),
176
+ default_value: Schema.optional(Schema.Number),
177
+ blocking: Schema.optional(Schema.Boolean),
178
+ optional: Schema.optional(Schema.Boolean),
179
+ description: Schema.optional(Schema.String),
180
+ values: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.String })),
181
+ all: Schema.optional(
182
+ Schema.Array(
183
+ Schema.Struct({
184
+ _account_id: Schema.optional(Schema.Number),
185
+ name: Schema.optional(Schema.String),
186
+ email: Schema.optional(Schema.String),
187
+ username: Schema.optional(Schema.String),
188
+ value: Schema.optional(Schema.Number),
189
+ post_submit: Schema.optional(Schema.Boolean),
190
+ permitted_voting_range: Schema.optional(
191
+ Schema.Struct({ min: Schema.Number, max: Schema.Number }),
192
+ ),
193
+ date: Schema.optional(Schema.String),
194
+ tag: Schema.optional(Schema.String),
195
+ }),
196
+ ),
197
+ ),
193
198
  }),
194
199
  }),
195
200
  ),
196
201
  submittable: Schema.optional(Schema.Boolean),
197
202
  work_in_progress: Schema.optional(Schema.Boolean),
203
+ is_private: Schema.optional(Schema.Boolean),
198
204
  current_revision: Schema.optional(Schema.String),
199
205
  revisions: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),
200
206
  topic: Schema.optional(Schema.String),
207
+ hashtags: Schema.optional(Schema.Array(Schema.String)),
201
208
  reviewers: Schema.optional(
202
209
  Schema.Struct({
203
210
  REVIEWER: Schema.optional(Schema.Array(ChangeReviewerAccountInfo)),
@@ -205,6 +212,22 @@ export const ChangeInfo: Schema.Schema<{
205
212
  REMOVED: Schema.optional(Schema.Array(ChangeReviewerAccountInfo)),
206
213
  }),
207
214
  ),
215
+ mergeable: Schema.optional(Schema.Boolean),
216
+ unresolved_comment_count: Schema.optional(Schema.Number),
217
+ total_comment_count: Schema.optional(Schema.Number),
218
+ attention_set: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),
219
+ submit_type: Schema.optional(Schema.String),
220
+ messages: Schema.optional(
221
+ Schema.Array(
222
+ Schema.Struct({
223
+ id: Schema.String,
224
+ message: Schema.String,
225
+ date: Schema.String,
226
+ _revision_number: Schema.optional(Schema.Number),
227
+ tag: Schema.optional(Schema.String),
228
+ }),
229
+ ),
230
+ ),
208
231
  })
209
232
  export type ChangeInfo = Schema.Schema.Type<typeof ChangeInfo>
210
233
 
@@ -223,6 +246,8 @@ export type CommentInput = Schema.Schema.Type<typeof CommentInput>
223
246
  export const CommentInfo: Schema.Schema<{
224
247
  readonly id: string
225
248
  readonly path?: string
249
+ readonly patch_set?: number
250
+ readonly side?: 'PARENT' | 'REVISION'
226
251
  readonly line?: number
227
252
  readonly range?: {
228
253
  readonly start_line: number
@@ -231,17 +256,18 @@ export const CommentInfo: Schema.Schema<{
231
256
  readonly end_character?: number
232
257
  }
233
258
  readonly message: string
234
- readonly author?: {
235
- readonly name?: string
236
- readonly email?: string
237
- readonly _account_id?: number
238
- }
259
+ readonly author?: ChangeReviewerAccount
239
260
  readonly updated?: string
240
261
  readonly unresolved?: boolean
241
262
  readonly in_reply_to?: string
263
+ readonly tag?: string
264
+ readonly change_message_id?: string
265
+ readonly commit_id?: string
242
266
  }> = Schema.Struct({
243
267
  id: Schema.String,
244
268
  path: Schema.optional(Schema.String),
269
+ patch_set: Schema.optional(Schema.Number),
270
+ side: Schema.optional(Schema.Literal('PARENT', 'REVISION')),
245
271
  line: Schema.optional(Schema.Number),
246
272
  range: Schema.optional(
247
273
  Schema.Struct({
@@ -252,40 +278,29 @@ export const CommentInfo: Schema.Schema<{
252
278
  }),
253
279
  ),
254
280
  message: Schema.String,
255
- author: Schema.optional(
256
- Schema.Struct({
257
- name: Schema.optional(Schema.String),
258
- email: Schema.optional(Schema.String),
259
- _account_id: Schema.optional(Schema.Number),
260
- }),
261
- ),
281
+ author: Schema.optional(ChangeReviewerAccountInfo),
262
282
  updated: Schema.optional(Schema.String),
263
283
  unresolved: Schema.optional(Schema.Boolean),
264
284
  in_reply_to: Schema.optional(Schema.String),
285
+ tag: Schema.optional(Schema.String),
286
+ change_message_id: Schema.optional(Schema.String),
287
+ commit_id: Schema.optional(Schema.String),
265
288
  })
266
289
  export type CommentInfo = Schema.Schema.Type<typeof CommentInfo>
267
290
 
268
291
  export const MessageInfo: Schema.Schema<{
269
292
  readonly id: string
270
293
  readonly message: string
271
- readonly author?: {
272
- readonly _account_id: number
273
- readonly name?: string
274
- readonly email?: string
275
- }
294
+ readonly author?: AccountInfo
295
+ readonly real_author?: AccountInfo
276
296
  readonly date: string
277
297
  readonly _revision_number?: number
278
298
  readonly tag?: string
279
299
  }> = Schema.Struct({
280
300
  id: Schema.String,
281
301
  message: Schema.String,
282
- author: Schema.optional(
283
- Schema.Struct({
284
- _account_id: Schema.Number,
285
- name: Schema.optional(Schema.String),
286
- email: Schema.optional(Schema.String),
287
- }),
288
- ),
302
+ author: Schema.optional(AccountInfo),
303
+ real_author: Schema.optional(AccountInfo),
289
304
  date: Schema.String,
290
305
  _revision_number: Schema.optional(Schema.Number),
291
306
  tag: Schema.optional(Schema.String),
@@ -343,35 +358,35 @@ export const ProjectInfo: Schema.Schema<{
343
358
  readonly id: string
344
359
  readonly name: string
345
360
  readonly parent?: string
361
+ readonly description?: string
346
362
  readonly state?: 'ACTIVE' | 'READ_ONLY' | 'HIDDEN'
347
363
  }> = Schema.Struct({
348
364
  id: Schema.String,
349
365
  name: Schema.String,
350
366
  parent: Schema.optional(Schema.String),
367
+ description: Schema.optional(Schema.String),
351
368
  state: Schema.optional(Schema.Literal('ACTIVE', 'READ_ONLY', 'HIDDEN')),
352
369
  })
353
370
  export type ProjectInfo = Schema.Schema.Type<typeof ProjectInfo>
354
371
 
355
- export const FileInfo: Schema.Schema<{
356
- readonly status?: 'A' | 'D' | 'R' | 'C' | 'M'
357
- readonly lines_inserted?: number
358
- readonly lines_deleted?: number
359
- readonly size?: number
360
- readonly size_delta?: number
361
- readonly old_path?: string
372
+ export const DiffFileMeta: Schema.Schema<{
373
+ readonly name: string
374
+ readonly content_type: string
375
+ readonly lines?: number
362
376
  }> = Schema.Struct({
363
- status: Schema.optional(Schema.Literal('A', 'D', 'R', 'C', 'M')), // Added, Deleted, Renamed, Copied, Modified
364
- lines_inserted: Schema.optional(Schema.Number),
365
- lines_deleted: Schema.optional(Schema.Number),
366
- size_delta: Schema.optional(Schema.Number),
367
- size: Schema.optional(Schema.Number),
368
- old_path: Schema.optional(Schema.String),
377
+ name: Schema.String,
378
+ content_type: Schema.String,
379
+ lines: Schema.optional(Schema.Number),
369
380
  })
370
- export type FileInfo = Schema.Schema.Type<typeof FileInfo>
381
+ export type DiffFileMeta = Schema.Schema.Type<typeof DiffFileMeta>
371
382
 
372
383
  export const FileDiffContent: Schema.Schema<{
373
- readonly a?: string
374
- readonly b?: string
384
+ readonly meta_a?: DiffFileMeta
385
+ readonly meta_b?: DiffFileMeta
386
+ readonly binary?: boolean
387
+ readonly change_type?: 'ADDED' | 'MODIFIED' | 'DELETED' | 'RENAMED' | 'COPIED' | 'REWRITE'
388
+ readonly diff_header?: ReadonlyArray<string>
389
+ readonly intraline_status?: 'OK' | 'TIMEOUT' | 'ERROR'
375
390
  readonly content: ReadonlyArray<{
376
391
  readonly a?: ReadonlyArray<string>
377
392
  readonly b?: ReadonlyArray<string>
@@ -384,11 +399,15 @@ export const FileDiffContent: Schema.Schema<{
384
399
  readonly due_to_rebase?: boolean
385
400
  readonly skip?: number
386
401
  }>
387
- readonly change_type?: 'ADDED' | 'MODIFIED' | 'DELETED' | 'RENAMED' | 'COPIED'
388
- readonly diff_header?: ReadonlyArray<string>
389
402
  }> = Schema.Struct({
390
- a: Schema.optional(Schema.String), // Old file content path
391
- b: Schema.optional(Schema.String), // New file content path
403
+ meta_a: Schema.optional(DiffFileMeta),
404
+ meta_b: Schema.optional(DiffFileMeta),
405
+ binary: Schema.optional(Schema.Boolean),
406
+ change_type: Schema.optional(
407
+ Schema.Literal('ADDED', 'MODIFIED', 'DELETED', 'RENAMED', 'COPIED', 'REWRITE'),
408
+ ),
409
+ diff_header: Schema.optional(Schema.Array(Schema.String)),
410
+ intraline_status: Schema.optional(Schema.Literal('OK', 'TIMEOUT', 'ERROR')),
392
411
  content: Schema.Array(
393
412
  Schema.Struct({
394
413
  a: Schema.optional(Schema.Array(Schema.String)), // Lines from old file
@@ -407,8 +426,6 @@ export const FileDiffContent: Schema.Schema<{
407
426
  skip: Schema.optional(Schema.Number),
408
427
  }),
409
428
  ),
410
- change_type: Schema.optional(Schema.Literal('ADDED', 'MODIFIED', 'DELETED', 'RENAMED', 'COPIED')),
411
- diff_header: Schema.optional(Schema.Array(Schema.String)),
412
429
  })
413
430
  export type FileDiffContent = Schema.Schema.Type<typeof FileDiffContent>
414
431
 
@@ -420,25 +437,16 @@ export const RevisionInfo: Schema.Schema<{
420
437
  readonly _account_id: number
421
438
  readonly name?: string
422
439
  readonly email?: string
440
+ readonly username?: string
423
441
  }
424
442
  readonly ref: string
425
443
  readonly fetch?: Record<string, unknown>
444
+ readonly description?: string
426
445
  readonly commit?: {
427
446
  readonly commit: string
428
- readonly parents: ReadonlyArray<{
429
- readonly commit: string
430
- readonly subject: string
431
- }>
432
- readonly author: {
433
- readonly name: string
434
- readonly email: string
435
- readonly date: string
436
- }
437
- readonly committer: {
438
- readonly name: string
439
- readonly email: string
440
- readonly date: string
441
- }
447
+ readonly parents: ReadonlyArray<{ readonly commit: string; readonly subject: string }>
448
+ readonly author: PersonDate
449
+ readonly committer: PersonDate
442
450
  readonly subject: string
443
451
  readonly message: string
444
452
  }
@@ -451,8 +459,10 @@ export const RevisionInfo: Schema.Schema<{
451
459
  readonly size?: number
452
460
  readonly size_delta?: number
453
461
  readonly old_path?: string
462
+ readonly binary?: boolean
454
463
  }
455
464
  >
465
+ readonly actions?: Record<string, unknown>
456
466
  }> = Schema.Struct({
457
467
  kind: Schema.optional(Schema.String),
458
468
  _number: Schema.Number,
@@ -461,9 +471,11 @@ export const RevisionInfo: Schema.Schema<{
461
471
  _account_id: Schema.Number,
462
472
  name: Schema.optional(Schema.String),
463
473
  email: Schema.optional(Schema.String),
474
+ username: Schema.optional(Schema.String),
464
475
  }),
465
476
  ref: Schema.String,
466
477
  fetch: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),
478
+ description: Schema.optional(Schema.String),
467
479
  commit: Schema.optional(
468
480
  Schema.Struct({
469
481
  commit: Schema.String,
@@ -488,8 +500,11 @@ export const RevisionInfo: Schema.Schema<{
488
500
  }),
489
501
  ),
490
502
  files: Schema.optional(Schema.Record({ key: Schema.String, value: FileInfo })),
503
+ actions: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),
491
504
  })
492
505
  export type RevisionInfo = Schema.Schema.Type<typeof RevisionInfo>
506
+ // Backwards-compatible alias used by mock-generator and other consumers
507
+ export type RevisionInfoType = RevisionShape
493
508
 
494
509
  // Diff output format options
495
510
  export const DiffFormat: Schema.Schema<'unified' | 'json' | 'files'> = Schema.Literal(
@@ -552,6 +567,7 @@ const ReviewerAccountInfo = Schema.Struct({
552
567
  _account_id: Schema.Number,
553
568
  name: Schema.optional(Schema.String),
554
569
  email: Schema.optional(Schema.String),
570
+ username: Schema.optional(Schema.String),
555
571
  })
556
572
 
557
573
  export const ReviewerResult: Schema.Schema<{
@@ -560,11 +576,13 @@ export const ReviewerResult: Schema.Schema<{
560
576
  readonly _account_id: number
561
577
  readonly name?: string
562
578
  readonly email?: string
579
+ readonly username?: string
563
580
  }>
564
581
  readonly ccs?: ReadonlyArray<{
565
582
  readonly _account_id: number
566
583
  readonly name?: string
567
584
  readonly email?: string
585
+ readonly username?: string
568
586
  }>
569
587
  readonly error?: string
570
588
  readonly confirm?: boolean
@@ -605,20 +623,6 @@ export const GerritError: Schema.Schema<{
605
623
  })
606
624
  export type GerritError = Schema.Schema.Type<typeof GerritError>
607
625
 
608
- // Account/User schema (reusable for groups and reviewers)
609
- export const AccountInfo: Schema.Schema<{
610
- readonly _account_id: number
611
- readonly name?: string
612
- readonly email?: string
613
- readonly username?: string
614
- }> = Schema.Struct({
615
- _account_id: Schema.Number,
616
- name: Schema.optional(Schema.String),
617
- email: Schema.optional(Schema.String),
618
- username: Schema.optional(Schema.String),
619
- })
620
- export type AccountInfo = Schema.Schema.Type<typeof AccountInfo>
621
-
622
626
  // Groups schemas
623
627
  export const GroupInfo: Schema.Schema<{
624
628
  readonly id: string
@@ -661,12 +665,7 @@ export const GroupDetailInfo: Schema.Schema<{
661
665
  readonly owner?: string
662
666
  readonly owner_id?: string
663
667
  readonly created_on?: string
664
- readonly members?: ReadonlyArray<{
665
- readonly _account_id: number
666
- readonly name?: string
667
- readonly email?: string
668
- readonly username?: string
669
- }>
668
+ readonly members?: ReadonlyArray<AccountInfo>
670
669
  readonly includes?: ReadonlyArray<{
671
670
  readonly id: string
672
671
  readonly name?: string
@@ -76,9 +76,11 @@ describe('diff command', () => {
76
76
  const mockDiff = {
77
77
  meta_a: {
78
78
  name: 'src/utils.js',
79
+ content_type: 'text/plain',
79
80
  },
80
81
  meta_b: {
81
82
  name: 'src/utils.js',
83
+ content_type: 'text/plain',
82
84
  },
83
85
  content: [
84
86
  {
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, test } from 'bun:test'
2
2
  import { Schema } from '@effect/schema'
3
- import { CommentInput, GerritCredentials } from '@/schemas/gerrit'
3
+ import { CommentInput, FileDiffContent, GerritCredentials } from '@/schemas/gerrit'
4
4
 
5
5
  describe('Gerrit Schemas', () => {
6
6
  describe('GerritCredentials', () => {
@@ -82,4 +82,55 @@ describe('Gerrit Schemas', () => {
82
82
  }).toThrow()
83
83
  })
84
84
  })
85
+
86
+ describe('FileDiffContent', () => {
87
+ const baseContent = { content: [] }
88
+
89
+ test('should accept change_type REWRITE', () => {
90
+ const result = Schema.decodeUnknownSync(FileDiffContent)({
91
+ ...baseContent,
92
+ change_type: 'REWRITE',
93
+ })
94
+ expect(result.change_type).toBe('REWRITE')
95
+ })
96
+
97
+ test('should accept intraline_status ERROR', () => {
98
+ const result = Schema.decodeUnknownSync(FileDiffContent)({
99
+ ...baseContent,
100
+ intraline_status: 'ERROR',
101
+ })
102
+ expect(result.intraline_status).toBe('ERROR')
103
+ })
104
+
105
+ test('should accept all valid change_type values', () => {
106
+ const values = ['ADDED', 'MODIFIED', 'DELETED', 'RENAMED', 'COPIED', 'REWRITE'] as const
107
+ for (const change_type of values) {
108
+ const result = Schema.decodeUnknownSync(FileDiffContent)({ ...baseContent, change_type })
109
+ expect(result.change_type).toBe(change_type)
110
+ }
111
+ })
112
+
113
+ test('should accept all valid intraline_status values', () => {
114
+ const values = ['OK', 'TIMEOUT', 'ERROR'] as const
115
+ for (const intraline_status of values) {
116
+ const result = Schema.decodeUnknownSync(FileDiffContent)({
117
+ ...baseContent,
118
+ intraline_status,
119
+ })
120
+ expect(result.intraline_status).toBe(intraline_status)
121
+ }
122
+ })
123
+
124
+ test('should reject invalid change_type', () => {
125
+ expect(() => {
126
+ Schema.decodeUnknownSync(FileDiffContent)({ ...baseContent, change_type: 'FAILURE' })
127
+ }).toThrow()
128
+ })
129
+
130
+ test('should reject invalid intraline_status', () => {
131
+ expect(() => {
132
+ Schema.decodeUnknownSync(FileDiffContent)({ ...baseContent, intraline_status: 'FAILURE' })
133
+ }).toThrow()
134
+ })
135
+ })
85
136
  })