-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Expand file tree
/
Copy pathtypes.ts
More file actions
1914 lines (1726 loc) · 54.9 KB
/
types.ts
File metadata and controls
1914 lines (1726 loc) · 54.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import type { OutputProperty, ToolFileData, ToolResponse } from '@/tools/types'
/**
* Shared output property definitions for GitHub API responses.
* These are reusable across all GitHub tools to ensure consistency.
*/
/**
* Output definition for GitHub user objects
*/
export const USER_OUTPUT_PROPERTIES = {
login: { type: 'string', description: 'GitHub username' },
id: { type: 'number', description: 'User ID' },
avatar_url: { type: 'string', description: 'Avatar image URL' },
html_url: { type: 'string', description: 'Profile URL' },
type: { type: 'string', description: 'Account type (User or Organization)' },
} as const satisfies Record<string, OutputProperty>
/**
* Complete user object output definition
*/
export const USER_OUTPUT = {
type: 'object',
description: 'GitHub user object',
properties: USER_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Extended user output properties for V2 tools (includes additional API fields)
*/
export const USER_FULL_OUTPUT_PROPERTIES = {
login: { type: 'string', description: 'GitHub username' },
id: { type: 'number', description: 'User ID' },
node_id: { type: 'string', description: 'GraphQL node ID' },
avatar_url: { type: 'string', description: 'Avatar image URL' },
url: { type: 'string', description: 'API URL' },
html_url: { type: 'string', description: 'Profile page URL' },
type: { type: 'string', description: 'User or Organization' },
site_admin: { type: 'boolean', description: 'GitHub staff indicator' },
} as const satisfies Record<string, OutputProperty>
/**
* Complete user object output definition for V2 tools
*/
export const USER_FULL_OUTPUT = {
type: 'object',
description: 'GitHub user object',
optional: true,
properties: USER_FULL_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Output definition for Git author/committer objects (name, email, date)
*/
export const GIT_ACTOR_OUTPUT_PROPERTIES = {
name: { type: 'string', description: 'Name' },
email: { type: 'string', description: 'Email address' },
date: { type: 'string', description: 'Timestamp (ISO 8601)' },
} as const satisfies Record<string, OutputProperty>
/**
* Complete Git actor output definition
*/
export const GIT_ACTOR_OUTPUT = {
type: 'object',
description: 'Git actor (author/committer)',
properties: GIT_ACTOR_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Output definition for commit tree objects
*/
export const COMMIT_TREE_OUTPUT_PROPERTIES = {
sha: { type: 'string', description: 'Tree SHA' },
url: { type: 'string', description: 'Tree API URL' },
} as const satisfies Record<string, OutputProperty>
/**
* Complete commit tree output definition
*/
export const COMMIT_TREE_OUTPUT = {
type: 'object',
description: 'Tree object',
properties: COMMIT_TREE_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Output definition for commit verification objects
*/
export const COMMIT_VERIFICATION_OUTPUT_PROPERTIES = {
verified: { type: 'boolean', description: 'Whether signature is verified' },
reason: { type: 'string', description: 'Verification reason' },
signature: { type: 'string', description: 'GPG signature', optional: true },
payload: { type: 'string', description: 'Signed payload', optional: true },
} as const satisfies Record<string, OutputProperty>
/**
* Complete commit verification output definition
*/
export const COMMIT_VERIFICATION_OUTPUT = {
type: 'object',
description: 'Signature verification',
properties: COMMIT_VERIFICATION_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Output definition for core commit data (the 'commit' field in GitHub API responses)
*/
export const COMMIT_DATA_OUTPUT_PROPERTIES = {
url: { type: 'string', description: 'Commit API URL' },
message: { type: 'string', description: 'Commit message' },
comment_count: { type: 'number', description: 'Number of comments' },
author: GIT_ACTOR_OUTPUT,
committer: GIT_ACTOR_OUTPUT,
tree: COMMIT_TREE_OUTPUT,
verification: COMMIT_VERIFICATION_OUTPUT,
} as const satisfies Record<string, OutputProperty>
/**
* Complete commit data output definition
*/
export const COMMIT_DATA_OUTPUT = {
type: 'object',
description: 'Core commit data',
properties: COMMIT_DATA_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Output definition for commit stats objects
*/
export const COMMIT_STATS_OUTPUT_PROPERTIES = {
additions: { type: 'number', description: 'Lines added' },
deletions: { type: 'number', description: 'Lines deleted' },
total: { type: 'number', description: 'Total changes' },
} as const satisfies Record<string, OutputProperty>
/**
* Complete commit stats output definition
*/
export const COMMIT_STATS_OUTPUT = {
type: 'object',
description: 'Change statistics',
optional: true,
properties: COMMIT_STATS_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Output definition for commit file/diff entry objects
*/
export const COMMIT_FILE_OUTPUT_PROPERTIES = {
sha: { type: 'string', description: 'Blob SHA', optional: true },
filename: { type: 'string', description: 'File path' },
status: {
type: 'string',
description: 'Change status (added, removed, modified, renamed, copied, changed, unchanged)',
},
additions: { type: 'number', description: 'Lines added' },
deletions: { type: 'number', description: 'Lines deleted' },
changes: { type: 'number', description: 'Total changes' },
blob_url: { type: 'string', description: 'Blob URL' },
raw_url: { type: 'string', description: 'Raw file URL' },
contents_url: { type: 'string', description: 'Contents API URL' },
patch: { type: 'string', description: 'Diff patch', optional: true },
previous_filename: {
type: 'string',
description: 'Previous filename (for renames)',
optional: true,
},
} as const satisfies Record<string, OutputProperty>
/**
* Complete commit file output definition
*/
export const COMMIT_FILE_OUTPUT = {
type: 'object',
description: 'Changed file (diff entry)',
properties: COMMIT_FILE_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Output definition for parent commit references
*/
export const COMMIT_PARENT_OUTPUT_PROPERTIES = {
sha: { type: 'string', description: 'Parent SHA' },
url: { type: 'string', description: 'Parent API URL' },
html_url: { type: 'string', description: 'Parent web URL' },
} as const satisfies Record<string, OutputProperty>
/**
* Complete parent commit output definition
*/
export const COMMIT_PARENT_OUTPUT = {
type: 'object',
description: 'Parent commit reference',
properties: COMMIT_PARENT_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Output definition for commit summary properties (common across list/search responses)
*/
export const COMMIT_SUMMARY_OUTPUT_PROPERTIES = {
sha: { type: 'string', description: 'Commit SHA' },
node_id: { type: 'string', description: 'GraphQL node ID' },
html_url: { type: 'string', description: 'GitHub web URL' },
url: { type: 'string', description: 'API URL' },
comments_url: { type: 'string', description: 'Comments API URL' },
} as const satisfies Record<string, OutputProperty>
/**
* Output definition for repository objects in search results
*/
export const SEARCH_REPO_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Repository ID' },
node_id: { type: 'string', description: 'GraphQL node ID' },
name: { type: 'string', description: 'Repository name' },
full_name: { type: 'string', description: 'Full name (owner/repo)' },
private: { type: 'boolean', description: 'Whether repository is private' },
html_url: { type: 'string', description: 'GitHub web URL' },
description: { type: 'string', description: 'Repository description', optional: true },
} as const satisfies Record<string, OutputProperty>
/**
* Complete search repository output definition
*/
export const SEARCH_REPO_OUTPUT = {
type: 'object',
description: 'Repository containing the commit',
properties: SEARCH_REPO_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Extended repository output properties for V2 tools (full API response)
*/
export const REPO_FULL_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Repository ID' },
node_id: { type: 'string', description: 'GraphQL node ID' },
name: { type: 'string', description: 'Repository name' },
full_name: { type: 'string', description: 'Full name (owner/repo)' },
private: { type: 'boolean', description: 'Whether repository is private' },
description: { type: 'string', description: 'Repository description', optional: true },
html_url: { type: 'string', description: 'GitHub web URL' },
url: { type: 'string', description: 'API URL' },
fork: { type: 'boolean', description: 'Whether this is a fork' },
created_at: { type: 'string', description: 'Creation timestamp' },
updated_at: { type: 'string', description: 'Last update timestamp' },
pushed_at: { type: 'string', description: 'Last push timestamp', optional: true },
size: { type: 'number', description: 'Repository size in KB' },
stargazers_count: { type: 'number', description: 'Number of stars' },
watchers_count: { type: 'number', description: 'Number of watchers' },
forks_count: { type: 'number', description: 'Number of forks' },
open_issues_count: { type: 'number', description: 'Number of open issues' },
language: { type: 'string', description: 'Primary programming language', optional: true },
default_branch: { type: 'string', description: 'Default branch name' },
visibility: { type: 'string', description: 'Repository visibility' },
archived: { type: 'boolean', description: 'Whether repository is archived' },
disabled: { type: 'boolean', description: 'Whether repository is disabled' },
} as const satisfies Record<string, OutputProperty>
/**
* License output properties
*/
export const LICENSE_OUTPUT_PROPERTIES = {
key: { type: 'string', description: 'License key (e.g., mit)' },
name: { type: 'string', description: 'License name' },
spdx_id: { type: 'string', description: 'SPDX identifier' },
} as const satisfies Record<string, OutputProperty>
/**
* Complete license object output definition
*/
export const LICENSE_OUTPUT = {
type: 'object',
description: 'License information',
optional: true,
properties: LICENSE_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Parent repository output properties for fork responses
*/
export const PARENT_REPO_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Repository ID' },
full_name: { type: 'string', description: 'Full name' },
html_url: { type: 'string', description: 'Web URL' },
description: { type: 'string', description: 'Description', optional: true },
} as const satisfies Record<string, OutputProperty>
/**
* Minimal parent owner output properties
*/
export const PARENT_OWNER_OUTPUT_PROPERTIES = {
login: { type: 'string', description: 'Username' },
id: { type: 'number', description: 'User ID' },
} as const satisfies Record<string, OutputProperty>
/**
* Source repository output properties (minimal)
*/
export const SOURCE_REPO_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Repository ID' },
full_name: { type: 'string', description: 'Full name' },
html_url: { type: 'string', description: 'Web URL' },
} as const satisfies Record<string, OutputProperty>
/**
* Output definition for branch reference objects (head/base in PRs)
*/
export const BRANCH_REF_OUTPUT_PROPERTIES = {
label: { type: 'string', description: 'Branch label (owner:branch)' },
ref: { type: 'string', description: 'Branch name' },
sha: { type: 'string', description: 'Commit SHA' },
} as const satisfies Record<string, OutputProperty>
/**
* Complete branch reference output definition
*/
export const BRANCH_REF_OUTPUT = {
type: 'object',
description: 'Branch reference info',
properties: BRANCH_REF_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Output definition for commit reference in branches (sha and url)
*/
export const COMMIT_REF_OUTPUT_PROPERTIES = {
sha: { type: 'string', description: 'Commit SHA' },
url: { type: 'string', description: 'Commit API URL' },
} as const satisfies Record<string, OutputProperty>
/**
* Complete commit reference output definition
*/
export const COMMIT_REF_OUTPUT = {
type: 'object',
description: 'Commit reference info',
properties: COMMIT_REF_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Output definition for branch objects
*/
export const BRANCH_OUTPUT_PROPERTIES = {
name: { type: 'string', description: 'Branch name' },
commit: COMMIT_REF_OUTPUT,
protected: { type: 'boolean', description: 'Whether branch is protected' },
} as const satisfies Record<string, OutputProperty>
/**
* Complete branch output definition
*/
export const BRANCH_OUTPUT = {
type: 'object',
description: 'Branch object',
properties: BRANCH_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Output definition for git reference objects (created branches)
*/
export const GIT_REF_OUTPUT_PROPERTIES = {
ref: { type: 'string', description: 'Full reference name (refs/heads/branch)' },
node_id: { type: 'string', description: 'Git ref node ID' },
url: { type: 'string', description: 'API URL for the reference' },
object: { type: 'json', description: 'Git object with type and sha' },
} as const satisfies Record<string, OutputProperty>
/**
* Complete git reference output definition
*/
export const GIT_REF_OUTPUT = {
type: 'object',
description: 'Git reference object',
properties: GIT_REF_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Output definition for branch protection settings
*/
export const BRANCH_PROTECTION_OUTPUT_PROPERTIES = {
url: { type: 'string', description: 'Protection settings URL' },
required_status_checks: {
type: 'json',
description: 'Status check requirements',
optional: true,
},
enforce_admins: { type: 'json', description: 'Admin enforcement settings' },
required_pull_request_reviews: {
type: 'json',
description: 'PR review requirements',
optional: true,
},
restrictions: { type: 'json', description: 'Push restrictions', optional: true },
required_linear_history: {
type: 'json',
description: 'Linear history requirement',
optional: true,
},
allow_force_pushes: { type: 'json', description: 'Force push settings', optional: true },
allow_deletions: { type: 'json', description: 'Deletion settings', optional: true },
block_creations: { type: 'json', description: 'Creation blocking settings', optional: true },
required_conversation_resolution: {
type: 'json',
description: 'Conversation resolution requirement',
optional: true,
},
required_signatures: { type: 'json', description: 'Signature requirements', optional: true },
} as const satisfies Record<string, OutputProperty>
/**
* Complete branch protection output definition
*/
export const BRANCH_PROTECTION_OUTPUT = {
type: 'object',
description: 'Branch protection configuration',
properties: BRANCH_PROTECTION_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Output definition for delete branch response
*/
export const DELETE_BRANCH_OUTPUT_PROPERTIES = {
deleted: { type: 'boolean', description: 'Whether the branch was deleted' },
branch: { type: 'string', description: 'Name of the deleted branch' },
} as const satisfies Record<string, OutputProperty>
/**
* Extended output definition for milestone creator user objects (V2 tools)
*/
export const MILESTONE_CREATOR_OUTPUT_PROPERTIES = {
login: { type: 'string', description: 'Username' },
id: { type: 'number', description: 'User ID' },
node_id: { type: 'string', description: 'GraphQL node ID' },
avatar_url: { type: 'string', description: 'Avatar image URL' },
url: { type: 'string', description: 'API URL' },
html_url: { type: 'string', description: 'Profile page URL' },
type: { type: 'string', description: 'User or Organization' },
site_admin: { type: 'boolean', description: 'GitHub staff indicator' },
} as const satisfies Record<string, OutputProperty>
/**
* Complete milestone creator output definition (V2 tools)
*/
export const MILESTONE_CREATOR_OUTPUT = {
type: 'object',
description: 'Milestone creator',
optional: true,
properties: MILESTONE_CREATOR_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Extended output definition for V2 milestone objects (full API response)
*/
export const MILESTONE_V2_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Milestone ID' },
node_id: { type: 'string', description: 'GraphQL node ID' },
number: { type: 'number', description: 'Milestone number' },
title: { type: 'string', description: 'Milestone title' },
description: { type: 'string', description: 'Milestone description', optional: true },
state: { type: 'string', description: 'State (open or closed)' },
url: { type: 'string', description: 'API URL' },
html_url: { type: 'string', description: 'GitHub web URL' },
labels_url: { type: 'string', description: 'Labels API URL' },
due_on: { type: 'string', description: 'Due date (ISO 8601)', optional: true },
open_issues: { type: 'number', description: 'Number of open issues' },
closed_issues: { type: 'number', description: 'Number of closed issues' },
created_at: { type: 'string', description: 'Creation timestamp' },
updated_at: { type: 'string', description: 'Last update timestamp' },
closed_at: { type: 'string', description: 'Close timestamp', optional: true },
} as const satisfies Record<string, OutputProperty>
/**
* Output definition for GitHub Project V2 objects
*/
export const PROJECT_V2_OUTPUT_PROPERTIES = {
id: { type: 'string', description: 'Project node ID' },
title: { type: 'string', description: 'Project title' },
number: { type: 'number', description: 'Project number' },
url: { type: 'string', description: 'Project URL' },
closed: { type: 'boolean', description: 'Whether project is closed' },
public: { type: 'boolean', description: 'Whether project is public' },
shortDescription: { type: 'string', description: 'Short description', optional: true },
} as const satisfies Record<string, OutputProperty>
/**
* Extended output definition for V2 project objects (full API response)
*/
export const PROJECT_V2_FULL_OUTPUT_PROPERTIES = {
...PROJECT_V2_OUTPUT_PROPERTIES,
readme: { type: 'string', description: 'Project readme', optional: true },
createdAt: { type: 'string', description: 'Creation timestamp' },
updatedAt: { type: 'string', description: 'Last update timestamp' },
} as const satisfies Record<string, OutputProperty>
/**
* Output definition for gist file objects
*/
export const GIST_FILE_OUTPUT_PROPERTIES = {
filename: { type: 'string', description: 'File name' },
type: { type: 'string', description: 'MIME type' },
language: { type: 'string', description: 'Programming language', optional: true },
raw_url: { type: 'string', description: 'Raw file URL' },
size: { type: 'number', description: 'File size in bytes' },
truncated: { type: 'boolean', description: 'Whether content is truncated' },
content: { type: 'string', description: 'File content' },
} as const satisfies Record<string, OutputProperty>
/**
* Output definition for gist owner objects (extended user info)
*/
export const GIST_OWNER_OUTPUT_PROPERTIES = {
login: { type: 'string', description: 'Username' },
id: { type: 'number', description: 'User ID' },
node_id: { type: 'string', description: 'GraphQL node ID' },
avatar_url: { type: 'string', description: 'Avatar image URL' },
url: { type: 'string', description: 'API URL' },
html_url: { type: 'string', description: 'Profile page URL' },
type: { type: 'string', description: 'User or Organization' },
site_admin: { type: 'boolean', description: 'GitHub staff indicator' },
} as const satisfies Record<string, OutputProperty>
/**
* Complete gist owner object output definition
*/
export const GIST_OWNER_OUTPUT = {
type: 'object',
description: 'Gist owner',
optional: true,
properties: GIST_OWNER_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Output definition for gist objects (core properties)
*/
export const GIST_OUTPUT_PROPERTIES = {
id: { type: 'string', description: 'Gist ID' },
node_id: { type: 'string', description: 'GraphQL node ID' },
url: { type: 'string', description: 'API URL' },
html_url: { type: 'string', description: 'GitHub web URL' },
forks_url: { type: 'string', description: 'Forks API URL' },
commits_url: { type: 'string', description: 'Commits API URL' },
git_pull_url: { type: 'string', description: 'Git clone URL' },
git_push_url: { type: 'string', description: 'Git push URL' },
description: { type: 'string', description: 'Gist description', optional: true },
public: { type: 'boolean', description: 'Whether gist is public' },
truncated: { type: 'boolean', description: 'Whether content is truncated' },
comments: { type: 'number', description: 'Number of comments' },
comments_url: { type: 'string', description: 'Comments API URL' },
created_at: { type: 'string', description: 'Creation timestamp' },
updated_at: { type: 'string', description: 'Last update timestamp' },
} as const satisfies Record<string, OutputProperty>
/**
* Complete gist files object output definition
*/
export const GIST_FILES_OUTPUT = {
type: 'object',
description: 'Files in the gist (keyed by filename)',
properties: {
'[filename]': {
type: 'object',
description: 'File object',
properties: GIST_FILE_OUTPUT_PROPERTIES,
},
},
} as const satisfies OutputProperty
/**
* Output definition for GitHub label objects
* @see https://docs.github.com/en/rest/issues/labels
*/
export const LABEL_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Label ID' },
node_id: { type: 'string', description: 'GraphQL node ID' },
url: { type: 'string', description: 'API URL' },
name: { type: 'string', description: 'Label name' },
description: { type: 'string', description: 'Label description', optional: true },
color: { type: 'string', description: 'Hex color code (without #)' },
default: { type: 'boolean', description: 'Whether this is a default label' },
} as const satisfies Record<string, OutputProperty>
/**
* Complete label object output definition
*/
export const LABEL_OUTPUT = {
type: 'object',
description: 'GitHub label object',
properties: LABEL_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Output definition for GitHub milestone objects
* @see https://docs.github.com/en/rest/issues/milestones
*/
export const MILESTONE_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Milestone ID' },
node_id: { type: 'string', description: 'GraphQL node ID' },
number: { type: 'number', description: 'Milestone number' },
title: { type: 'string', description: 'Milestone title' },
description: { type: 'string', description: 'Milestone description', optional: true },
state: { type: 'string', description: 'State (open or closed)' },
url: { type: 'string', description: 'API URL' },
html_url: { type: 'string', description: 'GitHub web URL' },
labels_url: { type: 'string', description: 'Labels API URL' },
due_on: { type: 'string', description: 'Due date (ISO 8601)', optional: true },
open_issues: { type: 'number', description: 'Number of open issues' },
closed_issues: { type: 'number', description: 'Number of closed issues' },
created_at: { type: 'string', description: 'Creation timestamp' },
updated_at: { type: 'string', description: 'Last update timestamp' },
closed_at: { type: 'string', description: 'Close timestamp', optional: true },
} as const satisfies Record<string, OutputProperty>
/**
* Complete milestone object output definition
*/
export const MILESTONE_OUTPUT = {
type: 'object',
description: 'GitHub milestone object',
optional: true,
properties: MILESTONE_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Output definition for GitHub issue objects (V2 tools)
* @see https://docs.github.com/en/rest/issues/issues
*/
export const ISSUE_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Issue ID' },
number: { type: 'number', description: 'Issue number' },
title: { type: 'string', description: 'Issue title' },
state: { type: 'string', description: 'Issue state (open/closed)' },
html_url: { type: 'string', description: 'GitHub web URL' },
body: { type: 'string', description: 'Issue body/description', optional: true },
created_at: { type: 'string', description: 'Creation timestamp' },
updated_at: { type: 'string', description: 'Last update timestamp' },
closed_at: { type: 'string', description: 'Close timestamp', optional: true },
state_reason: {
type: 'string',
description: 'State reason (completed/not_planned)',
optional: true,
},
} as const satisfies Record<string, OutputProperty>
/**
* Output definition for GitHub comment objects (V2 tools)
* @see https://docs.github.com/en/rest/issues/comments
*/
export const COMMENT_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Comment ID' },
body: { type: 'string', description: 'Comment body' },
html_url: { type: 'string', description: 'GitHub web URL' },
path: { type: 'string', description: 'File path (for file comments)', optional: true },
line: { type: 'number', description: 'Line number (for file comments)', optional: true },
side: { type: 'string', description: 'Side (LEFT/RIGHT for diff comments)', optional: true },
commit_id: { type: 'string', description: 'Commit SHA', optional: true },
created_at: { type: 'string', description: 'Creation timestamp' },
updated_at: { type: 'string', description: 'Last update timestamp' },
} as const satisfies Record<string, OutputProperty>
/**
* Output definition for GitHub reaction objects
* @see https://docs.github.com/en/rest/reactions
*/
export const REACTION_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Reaction ID' },
node_id: { type: 'string', description: 'GraphQL node ID' },
content: {
type: 'string',
description: 'Reaction type (+1, -1, laugh, confused, heart, hooray, rocket, eyes)',
},
created_at: { type: 'string', description: 'Creation timestamp' },
} as const satisfies Record<string, OutputProperty>
/**
* Output definition for GitHub release asset objects
* @see https://docs.github.com/en/rest/releases/assets
*/
export const RELEASE_ASSET_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Asset ID' },
node_id: { type: 'string', description: 'GraphQL node ID' },
name: { type: 'string', description: 'Asset filename' },
label: { type: 'string', description: 'Asset label', optional: true },
state: { type: 'string', description: 'Asset state (uploaded/open)' },
content_type: { type: 'string', description: 'MIME type' },
size: { type: 'number', description: 'File size in bytes' },
download_count: { type: 'number', description: 'Number of downloads' },
browser_download_url: { type: 'string', description: 'Direct download URL' },
created_at: { type: 'string', description: 'Upload timestamp' },
updated_at: { type: 'string', description: 'Last update timestamp' },
} as const satisfies Record<string, OutputProperty>
/**
* Output definition for GitHub release objects (V2 tools)
* @see https://docs.github.com/en/rest/releases/releases
*/
export const RELEASE_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Release ID' },
node_id: { type: 'string', description: 'GraphQL node ID' },
tag_name: { type: 'string', description: 'Git tag name' },
name: { type: 'string', description: 'Release name', optional: true },
body: { type: 'string', description: 'Release notes (markdown)', optional: true },
html_url: { type: 'string', description: 'GitHub web URL' },
tarball_url: { type: 'string', description: 'Source tarball URL' },
zipball_url: { type: 'string', description: 'Source zipball URL' },
draft: { type: 'boolean', description: 'Whether this is a draft release' },
prerelease: { type: 'boolean', description: 'Whether this is a prerelease' },
target_commitish: { type: 'string', description: 'Target branch or commit SHA' },
created_at: { type: 'string', description: 'Creation timestamp' },
published_at: { type: 'string', description: 'Publication timestamp', optional: true },
} as const satisfies Record<string, OutputProperty>
/**
* Output definition for GitHub workflow objects (V2 tools)
* @see https://docs.github.com/en/rest/actions/workflows
*/
export const WORKFLOW_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Workflow ID' },
node_id: { type: 'string', description: 'GraphQL node ID' },
name: { type: 'string', description: 'Workflow name' },
path: { type: 'string', description: 'Path to workflow file' },
state: {
type: 'string',
description: 'Workflow state (active/disabled_manually/disabled_inactivity)',
},
html_url: { type: 'string', description: 'GitHub web URL' },
badge_url: { type: 'string', description: 'Status badge URL' },
url: { type: 'string', description: 'API URL' },
created_at: { type: 'string', description: 'Creation timestamp' },
updated_at: { type: 'string', description: 'Last update timestamp' },
deleted_at: { type: 'string', description: 'Deletion timestamp', optional: true },
} as const satisfies Record<string, OutputProperty>
/**
* Output definition for head commit in workflow runs
* @see https://docs.github.com/en/rest/actions/workflow-runs
*/
export const HEAD_COMMIT_OUTPUT_PROPERTIES = {
id: { type: 'string', description: 'Commit SHA' },
tree_id: { type: 'string', description: 'Tree SHA' },
message: { type: 'string', description: 'Commit message' },
timestamp: { type: 'string', description: 'Commit timestamp' },
} as const satisfies Record<string, OutputProperty>
/**
* Complete head commit output definition
*/
export const HEAD_COMMIT_OUTPUT = {
type: 'object',
description: 'Head commit information',
optional: true,
properties: HEAD_COMMIT_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Output definition for PR references in workflow runs
*/
export const PR_REFERENCE_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Pull request ID' },
number: { type: 'number', description: 'Pull request number' },
url: { type: 'string', description: 'API URL' },
} as const satisfies Record<string, OutputProperty>
/**
* Complete PR reference output definition
*/
export const PR_REFERENCE_OUTPUT = {
type: 'object',
description: 'Pull request reference',
properties: PR_REFERENCE_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Output definition for referenced workflows in workflow runs
*/
export const REFERENCED_WORKFLOW_OUTPUT_PROPERTIES = {
path: { type: 'string', description: 'Path to referenced workflow' },
sha: { type: 'string', description: 'Commit SHA of referenced workflow' },
ref: { type: 'string', description: 'Git ref of referenced workflow', optional: true },
} as const satisfies Record<string, OutputProperty>
/**
* Complete referenced workflow output definition
*/
export const REFERENCED_WORKFLOW_OUTPUT = {
type: 'object',
description: 'Referenced workflow',
properties: REFERENCED_WORKFLOW_OUTPUT_PROPERTIES,
} as const satisfies OutputProperty
/**
* Output definition for GitHub workflow run objects (V2 tools)
* @see https://docs.github.com/en/rest/actions/workflow-runs
*/
export const WORKFLOW_RUN_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Workflow run ID' },
name: { type: 'string', description: 'Workflow name', optional: true },
head_branch: { type: 'string', description: 'Head branch name', optional: true },
head_sha: { type: 'string', description: 'Head commit SHA' },
run_number: { type: 'number', description: 'Run number' },
run_attempt: { type: 'number', description: 'Run attempt number' },
event: { type: 'string', description: 'Event that triggered the run' },
status: { type: 'string', description: 'Run status (queued/in_progress/completed)' },
conclusion: {
type: 'string',
description: 'Run conclusion (success/failure/cancelled/etc)',
optional: true,
},
workflow_id: { type: 'number', description: 'Associated workflow ID' },
html_url: { type: 'string', description: 'GitHub web URL' },
logs_url: { type: 'string', description: 'Logs download URL' },
jobs_url: { type: 'string', description: 'Jobs API URL' },
artifacts_url: { type: 'string', description: 'Artifacts API URL' },
run_started_at: { type: 'string', description: 'Run start timestamp', optional: true },
created_at: { type: 'string', description: 'Creation timestamp' },
updated_at: { type: 'string', description: 'Last update timestamp' },
} as const satisfies Record<string, OutputProperty>
/**
* Output definition for PR file objects (changed files in a PR)
* @see https://docs.github.com/en/rest/pulls/pulls#list-pull-requests-files
*/
export const PR_FILE_OUTPUT_PROPERTIES = {
sha: { type: 'string', description: 'Blob SHA' },
filename: { type: 'string', description: 'File path' },
status: {
type: 'string',
description: 'Change status (added/removed/modified/renamed/copied/changed/unchanged)',
},
additions: { type: 'number', description: 'Lines added' },
deletions: { type: 'number', description: 'Lines deleted' },
changes: { type: 'number', description: 'Total line changes' },
blob_url: { type: 'string', description: 'Blob URL' },
raw_url: { type: 'string', description: 'Raw file URL' },
contents_url: { type: 'string', description: 'Contents API URL' },
patch: { type: 'string', description: 'Diff patch', optional: true },
previous_filename: {
type: 'string',
description: 'Previous filename (for renames)',
optional: true,
},
} as const satisfies Record<string, OutputProperty>
/**
* Output definition for PR review comment objects
* @see https://docs.github.com/en/rest/pulls/comments
*/
export const PR_COMMENT_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Comment ID' },
node_id: { type: 'string', description: 'GraphQL node ID' },
body: { type: 'string', description: 'Comment body' },
html_url: { type: 'string', description: 'GitHub web URL' },
path: { type: 'string', description: 'File path' },
position: { type: 'number', description: 'Position in diff', optional: true },
line: { type: 'number', description: 'Line number', optional: true },
side: { type: 'string', description: 'Side (LEFT/RIGHT)', optional: true },
commit_id: { type: 'string', description: 'Commit SHA' },
original_commit_id: { type: 'string', description: 'Original commit SHA' },
diff_hunk: { type: 'string', description: 'Diff hunk context' },
created_at: { type: 'string', description: 'Creation timestamp' },
updated_at: { type: 'string', description: 'Last update timestamp' },
} as const satisfies Record<string, OutputProperty>
/**
* Output definition for PR summary objects (list view)
* @see https://docs.github.com/en/rest/pulls/pulls#list-pull-requests
*/
export const PR_SUMMARY_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Pull request ID' },
node_id: { type: 'string', description: 'GraphQL node ID' },
number: { type: 'number', description: 'Pull request number' },
title: { type: 'string', description: 'PR title' },
state: { type: 'string', description: 'PR state (open/closed)' },
html_url: { type: 'string', description: 'GitHub web URL' },
diff_url: { type: 'string', description: 'Diff URL' },
body: { type: 'string', description: 'PR description', optional: true },
locked: { type: 'boolean', description: 'Whether PR is locked' },
draft: { type: 'boolean', description: 'Whether PR is a draft' },
created_at: { type: 'string', description: 'Creation timestamp' },
updated_at: { type: 'string', description: 'Last update timestamp' },
closed_at: { type: 'string', description: 'Close timestamp', optional: true },
merged_at: { type: 'string', description: 'Merge timestamp', optional: true },
} as const satisfies Record<string, OutputProperty>
// Base parameters shared by all GitHub operations
export interface BaseGitHubParams {
owner: string
repo: string
apiKey: string
}
// PR operation parameters
export interface PROperationParams extends BaseGitHubParams {
pullNumber: number
}
// Comment operation parameters
export interface CreateCommentParams extends PROperationParams {
body: string
path?: string
position?: number
line?: number
side?: string
commitId?: string
commentType?: 'pr_comment' | 'file_comment'
}
// Latest commit parameters
export interface LatestCommitParams extends BaseGitHubParams {
branch?: string
}
// Create PR parameters
export interface CreatePRParams extends BaseGitHubParams {
title: string
head: string
base: string
body?: string
draft?: boolean
}
// Update PR parameters
export interface UpdatePRParams extends BaseGitHubParams {
pullNumber: number
title?: string
body?: string
state?: 'open' | 'closed'
base?: string
}
// Merge PR parameters
export interface MergePRParams extends BaseGitHubParams {
pullNumber: number
commit_title?: string
commit_message?: string
merge_method?: 'merge' | 'squash' | 'rebase'
}
// List PRs parameters
export interface ListPRsParams extends BaseGitHubParams {
state?: 'open' | 'closed' | 'all'
head?: string
base?: string
sort?: 'created' | 'updated' | 'popularity' | 'long-running'
direction?: 'asc' | 'desc'
per_page?: number
page?: number
}
// Get PR files parameters
export interface GetPRFilesParams extends BaseGitHubParams {
pullNumber: number
per_page?: number
page?: number
}
// Close PR parameters
export interface ClosePRParams extends BaseGitHubParams {
pullNumber: number
}
// Request reviewers parameters
export interface RequestReviewersParams extends BaseGitHubParams {
pullNumber: number
reviewers: string
team_reviewers?: string
}
// Response metadata interfaces
interface BasePRMetadata {
number: number
title: string
state: string
html_url: string
diff_url: string
created_at: string
updated_at: string
}
interface PRFilesMetadata {
files?: Array<{
filename: string
additions: number
deletions: number
changes: number
patch?: string
blob_url: string
raw_url: string
status: string
}>
}
interface PRCommentsMetadata {
comments?: Array<{
id: number
body: string
path?: string
line?: number
commit_id: string
created_at: string
updated_at: string