@hearsay-tools/squawk 0.18.0-dev.8312 → 0.18.0-dev.8321

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.
@@ -0,0 +1,733 @@
1
+ import { type ForgeFactory, type resolveForge } from './forge/index.ts';
2
+ import { getRepoInfo } from './git.ts';
3
+ import type { ProjectApiEnv } from './server-types.ts';
4
+ export interface GithubRouteDeps {
5
+ forgeFactory?: ForgeFactory | undefined;
6
+ resolveProjectForge: (info: Awaited<ReturnType<typeof getRepoInfo>>) => ReturnType<typeof resolveForge>;
7
+ }
8
+ export declare function createGithubRoutes(deps: GithubRouteDeps): import("hono/hono-base").HonoBase<ProjectApiEnv, {
9
+ "/github": {
10
+ $get: {
11
+ output: {
12
+ error: string;
13
+ code?: "invalid_input" | undefined;
14
+ };
15
+ outputFormat: "json";
16
+ status: 400;
17
+ input: {
18
+ query: {
19
+ limit?: string | undefined;
20
+ refresh?: string | undefined;
21
+ issuesCursor?: string | undefined;
22
+ prsCursor?: string | undefined;
23
+ issuesDone?: "1" | undefined;
24
+ prsDone?: "1" | undefined;
25
+ };
26
+ };
27
+ } | {
28
+ output: {
29
+ available: boolean;
30
+ reason?: string | undefined;
31
+ repo?: string | undefined;
32
+ syncedAt?: string | undefined;
33
+ issues: {
34
+ kind: "issue" | "pr";
35
+ number: number;
36
+ title: string;
37
+ author: string;
38
+ createdAt: string;
39
+ labels: string[];
40
+ body?: string | undefined;
41
+ url: string;
42
+ comments: number;
43
+ assignees?: string[] | undefined;
44
+ projectIds?: string[] | undefined;
45
+ isDraft?: boolean | undefined;
46
+ additions?: number | undefined;
47
+ deletions?: number | undefined;
48
+ checks?: "failing" | "passing" | "pending" | null | undefined;
49
+ }[];
50
+ prs: {
51
+ kind: "issue" | "pr";
52
+ number: number;
53
+ title: string;
54
+ author: string;
55
+ createdAt: string;
56
+ labels: string[];
57
+ body?: string | undefined;
58
+ url: string;
59
+ comments: number;
60
+ assignees?: string[] | undefined;
61
+ projectIds?: string[] | undefined;
62
+ isDraft?: boolean | undefined;
63
+ additions?: number | undefined;
64
+ deletions?: number | undefined;
65
+ checks?: "failing" | "passing" | "pending" | null | undefined;
66
+ }[];
67
+ labelColors?: {
68
+ [x: string]: string;
69
+ } | undefined;
70
+ viewerLogin?: string | undefined;
71
+ projects?: {
72
+ id: string;
73
+ title: string;
74
+ url: string;
75
+ }[] | undefined;
76
+ projectsReason?: string | undefined;
77
+ projectsState?: "ready" | "refreshing" | "unavailable" | undefined;
78
+ projectsGeneration?: string | undefined;
79
+ issuesTotal?: number | undefined;
80
+ prsTotal?: number | undefined;
81
+ issuesNextCursor?: string | null | undefined;
82
+ prsNextCursor?: string | null | undefined;
83
+ commentsDeferred?: true | undefined;
84
+ };
85
+ outputFormat: "json";
86
+ status: import("hono/utils/http-status").ContentfulStatusCode;
87
+ input: {
88
+ query: {
89
+ limit?: string | undefined;
90
+ refresh?: string | undefined;
91
+ issuesCursor?: string | undefined;
92
+ prsCursor?: string | undefined;
93
+ issuesDone?: "1" | undefined;
94
+ prsDone?: "1" | undefined;
95
+ };
96
+ };
97
+ };
98
+ };
99
+ } & {
100
+ "/github/projects": {
101
+ $get: {
102
+ output: {
103
+ error: string;
104
+ code?: "invalid_input" | undefined;
105
+ };
106
+ outputFormat: "json";
107
+ status: 400;
108
+ input: {
109
+ query: {
110
+ generation: string | string[];
111
+ };
112
+ };
113
+ } | {
114
+ output: {
115
+ generation: string;
116
+ state: "ready";
117
+ projects: {
118
+ id: string;
119
+ title: string;
120
+ url: string;
121
+ }[];
122
+ membership: {
123
+ [x: string]: string[];
124
+ };
125
+ } | {
126
+ generation: string;
127
+ state: "unavailable";
128
+ reason: string;
129
+ };
130
+ outputFormat: "json";
131
+ status: import("hono/utils/http-status").ContentfulStatusCode;
132
+ input: {
133
+ query: {
134
+ generation: string | string[];
135
+ };
136
+ };
137
+ };
138
+ };
139
+ } & {
140
+ "/github/comments/:kind/:number": {
141
+ $get: {
142
+ output: {
143
+ error: string;
144
+ code?: "invalid_input" | undefined;
145
+ };
146
+ outputFormat: "json";
147
+ status: 400;
148
+ input: {
149
+ query: {
150
+ refresh?: string | undefined;
151
+ };
152
+ } & {
153
+ param: {
154
+ kind: string;
155
+ } & {
156
+ number: string;
157
+ };
158
+ };
159
+ } | {
160
+ output: {
161
+ error: string;
162
+ };
163
+ outputFormat: "json";
164
+ status: 400;
165
+ input: {
166
+ query: {
167
+ refresh?: string | undefined;
168
+ };
169
+ } & {
170
+ param: {
171
+ kind: string;
172
+ } & {
173
+ number: string;
174
+ };
175
+ };
176
+ } | {
177
+ output: {
178
+ available: boolean;
179
+ reason?: string;
180
+ comments: {
181
+ id: number;
182
+ author: string;
183
+ avatarUrl?: string;
184
+ createdAt: string;
185
+ body: string;
186
+ kind: 'comment' | 'review';
187
+ reviewState?: 'approved' | 'changes_requested' | 'commented' | 'dismissed';
188
+ url: string;
189
+ }[];
190
+ truncated?: boolean;
191
+ events?: {
192
+ id: string;
193
+ kind: import("./forge/types.ts").ForgeTimelineEventKind;
194
+ actor: string;
195
+ avatarUrl?: string;
196
+ createdAt: string;
197
+ url?: string;
198
+ sha?: string;
199
+ message?: string;
200
+ checks?: 'passing' | 'failing' | 'pending' | null;
201
+ label?: {
202
+ name: string;
203
+ color?: string;
204
+ } | undefined;
205
+ subject?: string;
206
+ refNumber?: number;
207
+ refTitle?: string;
208
+ refIsPr?: boolean;
209
+ }[] | undefined;
210
+ detail?: {
211
+ body: string;
212
+ additions?: number;
213
+ deletions?: number;
214
+ } | undefined;
215
+ };
216
+ outputFormat: "json";
217
+ status: import("hono/utils/http-status").ContentfulStatusCode;
218
+ input: {
219
+ query: {
220
+ refresh?: string | undefined;
221
+ };
222
+ } & {
223
+ param: {
224
+ kind: string;
225
+ } & {
226
+ number: string;
227
+ };
228
+ };
229
+ };
230
+ };
231
+ } & {
232
+ "/github/items/:kind/:number": {
233
+ $get: {
234
+ output: {
235
+ error: string;
236
+ code?: "invalid_input" | undefined;
237
+ };
238
+ outputFormat: "json";
239
+ status: 400;
240
+ input: {
241
+ param: {
242
+ kind: "issue" | "pr";
243
+ number: string;
244
+ };
245
+ } & {
246
+ query: {
247
+ refresh?: string | undefined;
248
+ };
249
+ };
250
+ } | {
251
+ output: {
252
+ available: true;
253
+ item: {
254
+ kind: "issue" | "pr";
255
+ number: number;
256
+ title: string;
257
+ author: string;
258
+ createdAt: string;
259
+ labels: string[];
260
+ body?: string | undefined;
261
+ url: string;
262
+ comments: number;
263
+ assignees?: string[] | undefined;
264
+ projectIds?: string[] | undefined;
265
+ isDraft?: boolean | undefined;
266
+ additions?: number | undefined;
267
+ deletions?: number | undefined;
268
+ checks?: "failing" | "passing" | "pending" | null | undefined;
269
+ } | null;
270
+ labelColors?: {
271
+ [x: string]: string;
272
+ } | undefined;
273
+ } | {
274
+ available: false;
275
+ reason: string;
276
+ };
277
+ outputFormat: "json";
278
+ status: import("hono/utils/http-status").ContentfulStatusCode;
279
+ input: {
280
+ param: {
281
+ kind: "issue" | "pr";
282
+ number: string;
283
+ };
284
+ } & {
285
+ query: {
286
+ refresh?: string | undefined;
287
+ };
288
+ };
289
+ };
290
+ };
291
+ } & {
292
+ "/github/checks": {
293
+ $get: {
294
+ output: {
295
+ error: string;
296
+ code?: "invalid_input" | undefined;
297
+ };
298
+ outputFormat: "json";
299
+ status: 400;
300
+ input: {
301
+ query: {
302
+ prs: string | string[];
303
+ };
304
+ };
305
+ } | {
306
+ output: {
307
+ error: string;
308
+ };
309
+ outputFormat: "json";
310
+ status: 400;
311
+ input: {
312
+ query: {
313
+ prs: string | string[];
314
+ };
315
+ };
316
+ } | {
317
+ output: {
318
+ available: true;
319
+ checks: {
320
+ [x: number]: import("./forge/github-checks.ts").ChecksGlyph;
321
+ };
322
+ } | {
323
+ available: false;
324
+ reason: string;
325
+ };
326
+ outputFormat: "json";
327
+ status: import("hono/utils/http-status").ContentfulStatusCode;
328
+ input: {
329
+ query: {
330
+ prs: string | string[];
331
+ };
332
+ };
333
+ };
334
+ };
335
+ } & {
336
+ "/github/comment-counts": {
337
+ $get: {
338
+ output: {
339
+ error: string;
340
+ code?: "invalid_input" | undefined;
341
+ };
342
+ outputFormat: "json";
343
+ status: 400;
344
+ input: {
345
+ query: {
346
+ kind: "issue" | "pr";
347
+ numbers: string | string[];
348
+ refresh?: "1" | undefined;
349
+ };
350
+ };
351
+ } | {
352
+ output: {
353
+ available: true;
354
+ counts: {
355
+ [x: number]: number;
356
+ };
357
+ } | {
358
+ available: false;
359
+ reason: string;
360
+ };
361
+ outputFormat: "json";
362
+ status: import("hono/utils/http-status").ContentfulStatusCode;
363
+ input: {
364
+ query: {
365
+ kind: "issue" | "pr";
366
+ numbers: string | string[];
367
+ refresh?: "1" | undefined;
368
+ };
369
+ };
370
+ };
371
+ };
372
+ } & {
373
+ "/github/search": {
374
+ $get: {
375
+ output: {
376
+ error: string;
377
+ code?: "invalid_input" | undefined;
378
+ };
379
+ outputFormat: "json";
380
+ status: 400;
381
+ input: {
382
+ query: {
383
+ kind: "issue" | "pr";
384
+ q: string | string[];
385
+ limit?: number | undefined;
386
+ };
387
+ };
388
+ } | {
389
+ output: {
390
+ available: false;
391
+ reason: string;
392
+ items: never[];
393
+ };
394
+ outputFormat: "json";
395
+ status: import("hono/utils/http-status").ContentfulStatusCode;
396
+ input: {
397
+ query: {
398
+ kind: "issue" | "pr";
399
+ q: string | string[];
400
+ limit?: number | undefined;
401
+ };
402
+ };
403
+ } | {
404
+ output: {
405
+ available: boolean;
406
+ projectsReason?: string | undefined;
407
+ reason?: string | undefined;
408
+ items: {
409
+ kind: "issue" | "pr";
410
+ number: number;
411
+ title: string;
412
+ author: string;
413
+ createdAt: string;
414
+ labels: string[];
415
+ body?: string | undefined;
416
+ url: string;
417
+ comments: number;
418
+ assignees?: string[] | undefined;
419
+ projectIds?: string[] | undefined;
420
+ isDraft?: boolean | undefined;
421
+ additions?: number | undefined;
422
+ deletions?: number | undefined;
423
+ checks?: "failing" | "passing" | "pending" | null | undefined;
424
+ }[];
425
+ truncated?: boolean | undefined;
426
+ labelColors?: {
427
+ [x: string]: string;
428
+ } | undefined;
429
+ };
430
+ outputFormat: "json";
431
+ status: import("hono/utils/http-status").ContentfulStatusCode;
432
+ input: {
433
+ query: {
434
+ kind: "issue" | "pr";
435
+ q: string | string[];
436
+ limit?: number | undefined;
437
+ };
438
+ };
439
+ };
440
+ };
441
+ } & {
442
+ "/github/ref-status": {
443
+ $get: {
444
+ output: {
445
+ error: string;
446
+ code?: "invalid_input" | undefined;
447
+ };
448
+ outputFormat: "json";
449
+ status: 400;
450
+ input: {
451
+ query: {
452
+ prs?: string | undefined;
453
+ issues?: string | undefined;
454
+ };
455
+ };
456
+ } | {
457
+ output: {
458
+ error: string;
459
+ };
460
+ outputFormat: "json";
461
+ status: 400;
462
+ input: {
463
+ query: {
464
+ prs?: string | undefined;
465
+ issues?: string | undefined;
466
+ };
467
+ };
468
+ } | {
469
+ output: {
470
+ available: true;
471
+ prs: {
472
+ [x: number]: import("./forge/github-ref-status-derive.ts").ReferenceStatus;
473
+ };
474
+ issues: {
475
+ [x: number]: import("./forge/github-ref-status-derive.ts").ReferenceStatus;
476
+ };
477
+ conflicts?: number[];
478
+ recheckAfterMs: number | null;
479
+ } | {
480
+ available: false;
481
+ reason: string;
482
+ recheckAfterMs: number | null;
483
+ };
484
+ outputFormat: "json";
485
+ status: import("hono/utils/http-status").ContentfulStatusCode;
486
+ input: {
487
+ query: {
488
+ prs?: string | undefined;
489
+ issues?: string | undefined;
490
+ };
491
+ };
492
+ };
493
+ };
494
+ } & {
495
+ "/github/prs/:number/merge-state": {
496
+ $get: {
497
+ output: {
498
+ error: string;
499
+ code?: "invalid_input" | undefined;
500
+ };
501
+ outputFormat: "json";
502
+ status: 400;
503
+ input: {
504
+ param: {
505
+ number: string;
506
+ };
507
+ } & {
508
+ query: {
509
+ refresh?: string | undefined;
510
+ };
511
+ };
512
+ } | {
513
+ output: {
514
+ available: true;
515
+ mergeState: {
516
+ number: number;
517
+ title: string;
518
+ url: string;
519
+ state: "closed" | "merged" | "open";
520
+ isDraft: boolean;
521
+ headRef: string;
522
+ baseRef: string;
523
+ headSha: string;
524
+ mergeable: "conflicting" | "mergeable" | "unknown";
525
+ reviewDecision: "approved" | "changes-requested" | "not-required" | "review-required" | "unknown";
526
+ checks: {
527
+ name: string;
528
+ state: "failing" | "passing" | "pending" | "unknown";
529
+ required: boolean | null;
530
+ url?: string | undefined;
531
+ }[];
532
+ methods: ("merge" | "rebase" | "squash")[];
533
+ defaultMethod: "merge" | "rebase" | "squash" | null;
534
+ eligibility: "blocked" | "pending" | "ready" | "terminal" | "unauthorized" | "unknown";
535
+ blockers: {
536
+ code: string;
537
+ message: string;
538
+ }[];
539
+ canMerge: boolean;
540
+ canOverride: boolean;
541
+ };
542
+ } | {
543
+ available: false;
544
+ reason: string;
545
+ };
546
+ outputFormat: "json";
547
+ status: import("hono/utils/http-status").ContentfulStatusCode;
548
+ input: {
549
+ param: {
550
+ number: string;
551
+ };
552
+ } & {
553
+ query: {
554
+ refresh?: string | undefined;
555
+ };
556
+ };
557
+ };
558
+ };
559
+ } & {
560
+ "/github/prs/:number/merge": {
561
+ $post: {
562
+ output: {
563
+ error: string;
564
+ code?: "invalid_input" | undefined;
565
+ };
566
+ outputFormat: "json";
567
+ status: 400;
568
+ input: {
569
+ param: {
570
+ number: string;
571
+ };
572
+ } & {
573
+ json: {
574
+ method: "merge" | "rebase" | "squash";
575
+ expectedHeadSha: string;
576
+ overrideRules?: boolean | undefined;
577
+ };
578
+ };
579
+ } | {
580
+ output: {
581
+ error: string;
582
+ };
583
+ outputFormat: "json";
584
+ status: 409;
585
+ input: {
586
+ param: {
587
+ number: string;
588
+ };
589
+ } & {
590
+ json: {
591
+ method: "merge" | "rebase" | "squash";
592
+ expectedHeadSha: string;
593
+ overrideRules?: boolean | undefined;
594
+ };
595
+ };
596
+ } | {
597
+ output: {
598
+ merged: true;
599
+ number: number;
600
+ url: string;
601
+ method: import("./forge/types.ts").ForgeMergeMethod;
602
+ mergeCommitSha?: string;
603
+ };
604
+ outputFormat: "json";
605
+ status: import("hono/utils/http-status").ContentfulStatusCode;
606
+ input: {
607
+ param: {
608
+ number: string;
609
+ };
610
+ } & {
611
+ json: {
612
+ method: "merge" | "rebase" | "squash";
613
+ expectedHeadSha: string;
614
+ overrideRules?: boolean | undefined;
615
+ };
616
+ };
617
+ } | {
618
+ output: {
619
+ error: string;
620
+ code?: string | undefined;
621
+ current?: {
622
+ number: number;
623
+ title: string;
624
+ url: string;
625
+ state: "closed" | "merged" | "open";
626
+ isDraft: boolean;
627
+ headRef: string;
628
+ baseRef: string;
629
+ headSha: string;
630
+ mergeable: "conflicting" | "mergeable" | "unknown";
631
+ reviewDecision: "approved" | "changes-requested" | "not-required" | "review-required" | "unknown";
632
+ checks: {
633
+ name: string;
634
+ state: "failing" | "passing" | "pending" | "unknown";
635
+ required: boolean | null;
636
+ url?: string | undefined;
637
+ }[];
638
+ methods: ("merge" | "rebase" | "squash")[];
639
+ defaultMethod: "merge" | "rebase" | "squash" | null;
640
+ eligibility: "blocked" | "pending" | "ready" | "terminal" | "unauthorized" | "unknown";
641
+ blockers: {
642
+ code: string;
643
+ message: string;
644
+ }[];
645
+ canMerge: boolean;
646
+ canOverride: boolean;
647
+ } | undefined;
648
+ };
649
+ outputFormat: "json";
650
+ status: 403 | 404 | 409 | 502;
651
+ input: {
652
+ param: {
653
+ number: string;
654
+ };
655
+ } & {
656
+ json: {
657
+ method: "merge" | "rebase" | "squash";
658
+ expectedHeadSha: string;
659
+ overrideRules?: boolean | undefined;
660
+ };
661
+ };
662
+ };
663
+ };
664
+ } & {
665
+ "/github/prs/:number/changes": {
666
+ $get: {
667
+ output: {
668
+ error: string;
669
+ code?: "invalid_input" | undefined;
670
+ };
671
+ outputFormat: "json";
672
+ status: 400;
673
+ input: {
674
+ param: {
675
+ number: string;
676
+ };
677
+ } & {
678
+ query: {
679
+ refresh?: "1" | undefined;
680
+ };
681
+ };
682
+ } | {
683
+ output: {
684
+ error: string;
685
+ };
686
+ outputFormat: "json";
687
+ status: 404;
688
+ input: {
689
+ param: {
690
+ number: string;
691
+ };
692
+ } & {
693
+ query: {
694
+ refresh?: "1" | undefined;
695
+ };
696
+ };
697
+ } | {
698
+ output: {
699
+ available: true;
700
+ number: number;
701
+ headSha: string;
702
+ files: {
703
+ path: string;
704
+ previousPath?: string;
705
+ status: 'added' | 'modified' | 'removed' | 'renamed' | 'copied' | 'changed';
706
+ additions: number;
707
+ deletions: number;
708
+ patch?: string;
709
+ patchUnavailableReason?: 'binary' | 'too-large' | 'not-provided';
710
+ truncated?: boolean;
711
+ }[];
712
+ additions: number;
713
+ deletions: number;
714
+ truncated: boolean;
715
+ reason?: string;
716
+ } | {
717
+ available: false;
718
+ reason: string;
719
+ };
720
+ outputFormat: "json";
721
+ status: import("hono/utils/http-status").ContentfulStatusCode;
722
+ input: {
723
+ param: {
724
+ number: string;
725
+ };
726
+ } & {
727
+ query: {
728
+ refresh?: "1" | undefined;
729
+ };
730
+ };
731
+ };
732
+ };
733
+ }, "/", "/github/prs/:number/changes">;